repo_name stringlengths 7 104 | file_path stringlengths 13 198 | context stringlengths 67 7.15k | import_statement stringlengths 16 4.43k | code stringlengths 40 6.98k | prompt stringlengths 227 8.27k | next_line stringlengths 8 795 |
|---|---|---|---|---|---|---|
rednaga/axmlprinter | src/test/java/android/content/res/chunk/types/NameSpaceTest.java | // Path: src/main/java/android/content/res/IntReader.java
// public class IntReader {
//
// private InputStream stream;
// private boolean bigEndian;
// private int bytesRead;
//
// public IntReader(InputStream stream, boolean bigEndian) {
// reset(stream, bigEndian);
// }
//
// /**
// * Reset the POJO to use a new stream.
// *
// * @param newStream the {@code InputStream} to use
// * @param isBigEndian a boolean for whether or not the stream is in Big Endian format
// */
// public void reset(InputStream newStream, boolean isBigEndian) {
// stream = newStream;
// bigEndian = isBigEndian;
// bytesRead = 0;
// }
//
// /**
// * Close the current stream being used by the POJO.
// */
// public void close() {
// if (stream != null) {
// try {
// stream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// reset(null, false);
// }
// }
//
// public int readByte() throws IOException {
// return readInt(1);
// }
//
// public int readShort() throws IOException {
// return readInt(2);
// }
//
// public int readInt() throws IOException {
// return readInt(4);
// }
//
// /**
// * Read an integer of a certain length from the current stream.
// *
// * @param length to read
// * @return
// * @throws IOException
// */
// public int readInt(int length) throws IOException {
// if ((length < 0) || (length > 4)) {
// throw new IllegalArgumentException();
// }
// int result = 0;
// int byteRead = 0;
// if (bigEndian) {
// for (int i = (length - 1) * 8; i >= 0; i -= 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// } else {
// length *= 8;
// for (int i = 0; i != length; i += 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// }
//
// return result;
// }
//
// /**
// * Skip a specific number of bytes in the stream.
// *
// * @param bytes
// * @throws IOException
// */
// public void skip(int bytes) throws IOException {
// if (bytes > 0) {
// if (stream.skip(bytes) != bytes) {
// throw new EOFException();
// }
// bytesRead += bytes;
// }
// }
//
// public void skipInt() throws IOException {
// skip(4);
// }
//
// public int getBytesRead() {
// return bytesRead;
// }
// }
| import android.content.res.IntReader;
import android.content.res.chunk.ChunkType;
import junit.framework.TestCase;
import org.junit.Assert;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | /*
* Copyright 2015 Red Naga
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.content.res.chunk.types;
/**
* @author tstrazzere
*/
public class NameSpaceTest extends TestCase {
private NameSpace underTest;
| // Path: src/main/java/android/content/res/IntReader.java
// public class IntReader {
//
// private InputStream stream;
// private boolean bigEndian;
// private int bytesRead;
//
// public IntReader(InputStream stream, boolean bigEndian) {
// reset(stream, bigEndian);
// }
//
// /**
// * Reset the POJO to use a new stream.
// *
// * @param newStream the {@code InputStream} to use
// * @param isBigEndian a boolean for whether or not the stream is in Big Endian format
// */
// public void reset(InputStream newStream, boolean isBigEndian) {
// stream = newStream;
// bigEndian = isBigEndian;
// bytesRead = 0;
// }
//
// /**
// * Close the current stream being used by the POJO.
// */
// public void close() {
// if (stream != null) {
// try {
// stream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// reset(null, false);
// }
// }
//
// public int readByte() throws IOException {
// return readInt(1);
// }
//
// public int readShort() throws IOException {
// return readInt(2);
// }
//
// public int readInt() throws IOException {
// return readInt(4);
// }
//
// /**
// * Read an integer of a certain length from the current stream.
// *
// * @param length to read
// * @return
// * @throws IOException
// */
// public int readInt(int length) throws IOException {
// if ((length < 0) || (length > 4)) {
// throw new IllegalArgumentException();
// }
// int result = 0;
// int byteRead = 0;
// if (bigEndian) {
// for (int i = (length - 1) * 8; i >= 0; i -= 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// } else {
// length *= 8;
// for (int i = 0; i != length; i += 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// }
//
// return result;
// }
//
// /**
// * Skip a specific number of bytes in the stream.
// *
// * @param bytes
// * @throws IOException
// */
// public void skip(int bytes) throws IOException {
// if (bytes > 0) {
// if (stream.skip(bytes) != bytes) {
// throw new EOFException();
// }
// bytesRead += bytes;
// }
// }
//
// public void skipInt() throws IOException {
// skip(4);
// }
//
// public int getBytesRead() {
// return bytesRead;
// }
// }
// Path: src/test/java/android/content/res/chunk/types/NameSpaceTest.java
import android.content.res.IntReader;
import android.content.res.chunk.ChunkType;
import junit.framework.TestCase;
import org.junit.Assert;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/*
* Copyright 2015 Red Naga
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.content.res.chunk.types;
/**
* @author tstrazzere
*/
public class NameSpaceTest extends TestCase {
private NameSpace underTest;
| private IntReader mockReader; |
rednaga/axmlprinter | src/test/java/android/content/res/chunk/types/EndTagTest.java | // Path: src/main/java/android/content/res/IntReader.java
// public class IntReader {
//
// private InputStream stream;
// private boolean bigEndian;
// private int bytesRead;
//
// public IntReader(InputStream stream, boolean bigEndian) {
// reset(stream, bigEndian);
// }
//
// /**
// * Reset the POJO to use a new stream.
// *
// * @param newStream the {@code InputStream} to use
// * @param isBigEndian a boolean for whether or not the stream is in Big Endian format
// */
// public void reset(InputStream newStream, boolean isBigEndian) {
// stream = newStream;
// bigEndian = isBigEndian;
// bytesRead = 0;
// }
//
// /**
// * Close the current stream being used by the POJO.
// */
// public void close() {
// if (stream != null) {
// try {
// stream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// reset(null, false);
// }
// }
//
// public int readByte() throws IOException {
// return readInt(1);
// }
//
// public int readShort() throws IOException {
// return readInt(2);
// }
//
// public int readInt() throws IOException {
// return readInt(4);
// }
//
// /**
// * Read an integer of a certain length from the current stream.
// *
// * @param length to read
// * @return
// * @throws IOException
// */
// public int readInt(int length) throws IOException {
// if ((length < 0) || (length > 4)) {
// throw new IllegalArgumentException();
// }
// int result = 0;
// int byteRead = 0;
// if (bigEndian) {
// for (int i = (length - 1) * 8; i >= 0; i -= 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// } else {
// length *= 8;
// for (int i = 0; i != length; i += 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// }
//
// return result;
// }
//
// /**
// * Skip a specific number of bytes in the stream.
// *
// * @param bytes
// * @throws IOException
// */
// public void skip(int bytes) throws IOException {
// if (bytes > 0) {
// if (stream.skip(bytes) != bytes) {
// throw new EOFException();
// }
// bytesRead += bytes;
// }
// }
//
// public void skipInt() throws IOException {
// skip(4);
// }
//
// public int getBytesRead() {
// return bytesRead;
// }
// }
| import android.content.res.IntReader;
import android.content.res.chunk.ChunkType;
import junit.framework.TestCase;
import org.junit.Assert;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when; | /*
* Copyright 2015 Red Naga
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.content.res.chunk.types;
/**
* @author tstrazzere
*/
public class EndTagTest extends TestCase {
private EndTag underTest;
| // Path: src/main/java/android/content/res/IntReader.java
// public class IntReader {
//
// private InputStream stream;
// private boolean bigEndian;
// private int bytesRead;
//
// public IntReader(InputStream stream, boolean bigEndian) {
// reset(stream, bigEndian);
// }
//
// /**
// * Reset the POJO to use a new stream.
// *
// * @param newStream the {@code InputStream} to use
// * @param isBigEndian a boolean for whether or not the stream is in Big Endian format
// */
// public void reset(InputStream newStream, boolean isBigEndian) {
// stream = newStream;
// bigEndian = isBigEndian;
// bytesRead = 0;
// }
//
// /**
// * Close the current stream being used by the POJO.
// */
// public void close() {
// if (stream != null) {
// try {
// stream.close();
// } catch (IOException e) {
// e.printStackTrace();
// }
// reset(null, false);
// }
// }
//
// public int readByte() throws IOException {
// return readInt(1);
// }
//
// public int readShort() throws IOException {
// return readInt(2);
// }
//
// public int readInt() throws IOException {
// return readInt(4);
// }
//
// /**
// * Read an integer of a certain length from the current stream.
// *
// * @param length to read
// * @return
// * @throws IOException
// */
// public int readInt(int length) throws IOException {
// if ((length < 0) || (length > 4)) {
// throw new IllegalArgumentException();
// }
// int result = 0;
// int byteRead = 0;
// if (bigEndian) {
// for (int i = (length - 1) * 8; i >= 0; i -= 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// } else {
// length *= 8;
// for (int i = 0; i != length; i += 8) {
// byteRead = stream.read();
// bytesRead++;
// if (byteRead == -1) {
// throw new EOFException();
// }
// result |= (byteRead << i);
// }
// }
//
// return result;
// }
//
// /**
// * Skip a specific number of bytes in the stream.
// *
// * @param bytes
// * @throws IOException
// */
// public void skip(int bytes) throws IOException {
// if (bytes > 0) {
// if (stream.skip(bytes) != bytes) {
// throw new EOFException();
// }
// bytesRead += bytes;
// }
// }
//
// public void skipInt() throws IOException {
// skip(4);
// }
//
// public int getBytesRead() {
// return bytesRead;
// }
// }
// Path: src/test/java/android/content/res/chunk/types/EndTagTest.java
import android.content.res.IntReader;
import android.content.res.chunk.ChunkType;
import junit.framework.TestCase;
import org.junit.Assert;
import static org.mockito.Mockito.mock;
import static org.mockito.Mockito.when;
/*
* Copyright 2015 Red Naga
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package android.content.res.chunk.types;
/**
* @author tstrazzere
*/
public class EndTagTest extends TestCase {
private EndTag underTest;
| private IntReader mockReader; |
JavaMoney/javamoney-examples | console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesAccess.java | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
| import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.CurrencyUnitBuilder;
import javax.money.CurrencyQueryBuilder;
import javax.money.Monetary; | /*
* JavaMoney Examples
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
public class CurrenciesAccess {
/**
* @param args
*/
public static void main(String[] args) { | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
// Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesAccess.java
import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.CurrencyUnitBuilder;
import javax.money.CurrencyQueryBuilder;
import javax.money.Monetary;
/*
* JavaMoney Examples
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
public class CurrenciesAccess {
/**
* @param args
*/
public static void main(String[] args) { | ConsoleUtils.printDetails(Monetary.getCurrency("CHF")); |
JavaMoney/javamoney-examples | console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesProgrammaticallyRegister.java | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
| import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.spi.ConfigurableCurrencyUnitProvider;
import javax.money.CurrencyContext;
import javax.money.CurrencyContextBuilder;
import javax.money.CurrencyUnit;
import javax.money.Monetary; | /*
* JavaMoney Examples
* Copyright 2012-2020, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically registers a CurrencyUnit on the fly into the current registry.
*/
public class CurrenciesProgrammaticallyRegister {
public static void main(String[] args) {
CurrencyUnit onTheFlyUnit = new CurrencyUnit() {
private CurrencyContext context = CurrencyContextBuilder.of("Devoxx-ToolsInAction").build();
@Override
public int compareTo(CurrencyUnit o) {
return this.getCurrencyCode().compareTo(o.getCurrencyCode());
}
@Override
public String getCurrencyCode() {
return "DevoxxFranc";
}
@Override
public int getNumericCode() {
return 800;
}
@Override
public int getDefaultFractionDigits() {
return 0;
}
@Override
public CurrencyContext getContext() {
return context;
}
};
ConfigurableCurrencyUnitProvider.registerCurrencyUnit(onTheFlyUnit); | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
// Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesProgrammaticallyRegister.java
import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.spi.ConfigurableCurrencyUnitProvider;
import javax.money.CurrencyContext;
import javax.money.CurrencyContextBuilder;
import javax.money.CurrencyUnit;
import javax.money.Monetary;
/*
* JavaMoney Examples
* Copyright 2012-2020, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically registers a CurrencyUnit on the fly into the current registry.
*/
public class CurrenciesProgrammaticallyRegister {
public static void main(String[] args) {
CurrencyUnit onTheFlyUnit = new CurrencyUnit() {
private CurrencyContext context = CurrencyContextBuilder.of("Devoxx-ToolsInAction").build();
@Override
public int compareTo(CurrencyUnit o) {
return this.getCurrencyCode().compareTo(o.getCurrencyCode());
}
@Override
public String getCurrencyCode() {
return "DevoxxFranc";
}
@Override
public int getNumericCode() {
return 800;
}
@Override
public int getDefaultFractionDigits() {
return 0;
}
@Override
public CurrencyContext getContext() {
return context;
}
};
ConfigurableCurrencyUnitProvider.registerCurrencyUnit(onTheFlyUnit); | ConsoleUtils.printDetails(Monetary.getCurrency("DevoxxFranc")); |
JavaMoney/javamoney-examples | console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesUseBuilder.java | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
| import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.CurrencyUnitBuilder;
import javax.money.CurrencyQueryBuilder;
import javax.money.Monetary; | /*
* JavaMoney Examples
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically builds and registers a CurrencyUnit into the shared registry.
*/
public class CurrenciesUseBuilder {
public static void main(String[] args) { | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
// Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesUseBuilder.java
import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.CurrencyUnitBuilder;
import javax.money.CurrencyQueryBuilder;
import javax.money.Monetary;
/*
* JavaMoney Examples
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically builds and registers a CurrencyUnit into the shared registry.
*/
public class CurrenciesUseBuilder {
public static void main(String[] args) { | ConsoleUtils.printDetails( |
JavaMoney/javamoney-examples | web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/handler/PaymentHandler.java | // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
| import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named; | /*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.handler;
/**
* @author Werner Keil
*
*/
@SessionScoped
public class PaymentHandler implements Serializable,ICreditEventObserver, IDebitEventObserver {
/**
*
*/
private static final long serialVersionUID = 5039671005494708392L;
@Inject
private Logger logger;
| // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/handler/PaymentHandler.java
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import java.io.Serializable;
import java.util.ArrayList;
import java.util.List;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Observes;
import javax.enterprise.inject.Produces;
import javax.inject.Inject;
import javax.inject.Named;
/*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.handler;
/**
* @author Werner Keil
*
*/
@SessionScoped
public class PaymentHandler implements Serializable,ICreditEventObserver, IDebitEventObserver {
/**
*
*/
private static final long serialVersionUID = 5039671005494708392L;
@Inject
private Logger logger;
| List<PaymentEvent> payments=new ArrayList<PaymentEvent>(); |
JavaMoney/javamoney-examples | console/javamoney-console-bp/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesProgrammaticallyRegister.java | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
| import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.spi.ConfigurableCurrencyUnitProvider;
import javax.money.CurrencyContext;
import javax.money.CurrencyContextBuilder;
import javax.money.CurrencyUnit;
import javax.money.Monetary; | /*
* JavaMoney Examples
* Copyright 2012-2014, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically registers a on the fly CurrencyUnit into the current registry.
*/
public class CurrenciesProgrammaticallyRegister {
public static void main(String[] args) {
CurrencyUnit onTheFlyUnit = new CurrencyUnit() {
private CurrencyContext context = CurrencyContextBuilder.of("GeeCon-onTheFly").build();
@Override
public int compareTo(CurrencyUnit o) {
return this.getCurrencyCode().compareTo(o.getCurrencyCode());
}
@Override
public String getCurrencyCode() {
return "GeeCon-Special";
}
@Override
public int getNumericCode() {
return 800;
}
@Override
public int getDefaultFractionDigits() {
return 0;
}
@Override
public CurrencyContext getContext() {
return context;
}
};
ConfigurableCurrencyUnitProvider.registerCurrencyUnit(onTheFlyUnit); | // Path: console/javamoney-console-simple/src/main/java/org/javamoney/examples/console/simple/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
// Path: console/javamoney-console-bp/src/main/java/org/javamoney/examples/console/simple/core/CurrenciesProgrammaticallyRegister.java
import org.javamoney.examples.console.simple.util.ConsoleUtils;
import org.javamoney.moneta.spi.ConfigurableCurrencyUnitProvider;
import javax.money.CurrencyContext;
import javax.money.CurrencyContextBuilder;
import javax.money.CurrencyUnit;
import javax.money.Monetary;
/*
* JavaMoney Examples
* Copyright 2012-2014, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.simple.core;
/**
* Programmatically registers a on the fly CurrencyUnit into the current registry.
*/
public class CurrenciesProgrammaticallyRegister {
public static void main(String[] args) {
CurrencyUnit onTheFlyUnit = new CurrencyUnit() {
private CurrencyContext context = CurrencyContextBuilder.of("GeeCon-onTheFly").build();
@Override
public int compareTo(CurrencyUnit o) {
return this.getCurrencyCode().compareTo(o.getCurrencyCode());
}
@Override
public String getCurrencyCode() {
return "GeeCon-Special";
}
@Override
public int getNumericCode() {
return 800;
}
@Override
public int getDefaultFractionDigits() {
return 0;
}
@Override
public CurrencyContext getContext() {
return context;
}
};
ConfigurableCurrencyUnitProvider.registerCurrencyUnit(onTheFlyUnit); | ConsoleUtils.printDetails(Monetary.getCurrency("GeeCon-Special")); |
JavaMoney/javamoney-examples | web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/beans/PaymentBean.java | // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
//
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
//
// CREDIT("1"), DEBIT("2");
//
// private final String value;
//
// static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
//
// static {
// for (PaymentType paymentType : PaymentType.values()) {
// map.put(paymentType.getValue(), paymentType);
// }
// }
//
// private PaymentType(String value) {
// this.value = value;
// }
//
// public String getValue() {
// return value;
// }
//
// public static PaymentType of(String value) {
// return map.get(value);
// }
// }
| import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount; | /*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.beans;
//import org.javamoney.annotation.Amount;
@Named
@SessionScoped
public class PaymentBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6634420857401223541L;
@Inject
private Logger log;
// Events producers
@Inject
@Credit | // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
//
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
//
// CREDIT("1"), DEBIT("2");
//
// private final String value;
//
// static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
//
// static {
// for (PaymentType paymentType : PaymentType.values()) {
// map.put(paymentType.getValue(), paymentType);
// }
// }
//
// private PaymentType(String value) {
// this.value = value;
// }
//
// public String getValue() {
// return value;
// }
//
// public static PaymentType of(String value) {
// return map.get(value);
// }
// }
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/beans/PaymentBean.java
import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount;
/*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.beans;
//import org.javamoney.annotation.Amount;
@Named
@SessionScoped
public class PaymentBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6634420857401223541L;
@Inject
private Logger log;
// Events producers
@Inject
@Credit | Event<PaymentEvent> creditEventProducer; |
JavaMoney/javamoney-examples | web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/beans/PaymentBean.java | // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
//
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
//
// CREDIT("1"), DEBIT("2");
//
// private final String value;
//
// static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
//
// static {
// for (PaymentType paymentType : PaymentType.values()) {
// map.put(paymentType.getValue(), paymentType);
// }
// }
//
// private PaymentType(String value) {
// this.value = value;
// }
//
// public String getValue() {
// return value;
// }
//
// public static PaymentType of(String value) {
// return map.get(value);
// }
// }
| import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount; | /*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.beans;
//import org.javamoney.annotation.Amount;
@Named
@SessionScoped
public class PaymentBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6634420857401223541L;
@Inject
private Logger log;
// Events producers
@Inject
@Credit
Event<PaymentEvent> creditEventProducer;
@Inject
@Debit
Event<PaymentEvent> debitEventProducer;
private static final CurrencyUnit CURRENCY = Monetary
.getCurrency("EUR");
@Amount
private BigDecimal amount = new BigDecimal(10.0);
@Amount
private MonetaryAmount money = Money.of(amount, CURRENCY);
public MonetaryAmount getMoney() {
return money;
}
public void setMoney(MonetaryAmount money) {
this.money = money;
}
| // Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentEvent.java
// public class PaymentEvent {
// private PaymentType type; //credit or debit
// private Date datetime;
// private MonetaryAmount money;
//
// public PaymentType getType() {
// return type;
// }
// public void setType(PaymentType type) {
// this.type = type;
// }
//
// public Date getDatetime() {
// return datetime;
// }
// public void setDatetime(Date datetime) {
// this.datetime = datetime;
// }
//
// public String toString(){
// return String.format("EVT: %s:%s:%s", getDatetime(), getMoney(), getType());
// }
// public MonetaryAmount getMoney() {
// return money;
// }
// public void setMoney(MonetaryAmount money) {
// this.money = money;
// }
// }
//
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/events/PaymentType.java
// public enum PaymentType {
//
// CREDIT("1"), DEBIT("2");
//
// private final String value;
//
// static final Map<String, PaymentType> map = new HashMap<String, PaymentType>();
//
// static {
// for (PaymentType paymentType : PaymentType.values()) {
// map.put(paymentType.getValue(), paymentType);
// }
// }
//
// private PaymentType(String value) {
// this.value = value;
// }
//
// public String getValue() {
// return value;
// }
//
// public static PaymentType of(String value) {
// return map.get(value);
// }
// }
// Path: web/javamoney-payment-cdi-event/src/main/java/org/javamoney/examples/cdi/payment/beans/PaymentBean.java
import javax.money.Monetary;
import org.javamoney.examples.cdi.payment.events.PaymentEvent;
import org.javamoney.examples.cdi.payment.events.PaymentType;
import org.javamoney.examples.cdi.payment.qualifiers.Amount;
import org.javamoney.examples.cdi.payment.qualifiers.Credit;
import org.javamoney.examples.cdi.payment.qualifiers.Debit;
import org.javamoney.moneta.Money;
import java.io.Serializable;
import java.math.BigDecimal;
import java.util.Date;
import java.util.logging.Logger;
import javax.enterprise.context.SessionScoped;
import javax.enterprise.event.Event;
import javax.inject.Inject;
import javax.inject.Named;
import javax.money.CurrencyUnit;
import javax.money.MonetaryAmount;
/*
* JavaMoney Examples
* Copyright 2012 Red Hat, Inc. and/or its affiliates,
* and individual contributors by the @author tags. See the copyright.txt in the
* distribution for a full listing of individual contributors
*
* Copyright 2012-2019, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.cdi.payment.beans;
//import org.javamoney.annotation.Amount;
@Named
@SessionScoped
public class PaymentBean implements Serializable {
/**
*
*/
private static final long serialVersionUID = 6634420857401223541L;
@Inject
private Logger log;
// Events producers
@Inject
@Credit
Event<PaymentEvent> creditEventProducer;
@Inject
@Debit
Event<PaymentEvent> debitEventProducer;
private static final CurrencyUnit CURRENCY = Monetary
.getCurrency("EUR");
@Amount
private BigDecimal amount = new BigDecimal(10.0);
@Amount
private MonetaryAmount money = Money.of(amount, CURRENCY);
public MonetaryAmount getMoney() {
return money;
}
public void setMoney(MonetaryAmount money) {
this.money = money;
}
| private String paymentOption = PaymentType.DEBIT.toString(); |
JavaMoney/javamoney-examples | console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/core/AmountsDoCalculations.java | // Path: console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
| import org.javamoney.examples.console.java10.util.ConsoleUtils;
import org.javamoney.moneta.FastMoney;
import org.javamoney.moneta.Money;
import javax.money.Monetary;
import javax.money.MonetaryAmountFactoryQueryBuilder;
| /*
* JavaMoney Examples
* Copyright 2012-2020, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.java10.core;
/**
* @author Werner Keil
* @version 1.0
*/
public class AmountsDoCalculations {
/**
* @param args
*/
public static void main(String[] args) {
var amount = Monetary.getDefaultAmountFactory().setCurrency("EUR").setNumber(234).create();
| // Path: console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/util/ConsoleUtils.java
// public final class ConsoleUtils {
//
// private ConsoleUtils(){}
//
// public static void printDetails(CurrencyUnit cu) {
// if (cu == null) {
// System.out.println("N/A");
// } else {
// System.out.println("CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(String title, CurrencyUnit cu) {
// if (cu == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> CurrencyUnit '" + cu.toString() + "':\n" +
// " Class : " + cu.getClass().getName() + "\n" +
// " Currency Code : " + cu.getCurrencyCode() + "\n" +
// " Num.Code : " + cu.getNumericCode() + "\n" +
// " DefaultFraction Digits: " + cu.getDefaultFractionDigits() + "\n" +
// " Context : " + cu.getContext());
// }
// }
//
// public static void printDetails(MonetaryAmount am) {
// if (am == null) {
// System.out.println("N/A");
// } else {
// System.out.println("Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
//
// public static void printDetails(String title, MonetaryAmount am) {
// if (am == null) {
// System.out.println(title + " -> N/A");
// } else {
// System.out.println(title + " -> Amount '" + am.toString() + "':\n" +
// " Class : " + am.getClass().getName() + "\n" +
// " CurrencyUnit : " + am.getCurrency().getCurrencyCode() + "\n" +
// " Number : " + am.getNumber() + "\n" +
// " Context : " + am.getContext());
// }
// }
// }
// Path: console/javamoney-console-java10/src/main/java/org/javamoney/examples/console/java10/core/AmountsDoCalculations.java
import org.javamoney.examples.console.java10.util.ConsoleUtils;
import org.javamoney.moneta.FastMoney;
import org.javamoney.moneta.Money;
import javax.money.Monetary;
import javax.money.MonetaryAmountFactoryQueryBuilder;
/*
* JavaMoney Examples
* Copyright 2012-2020, Werner Keil
* and individual contributors by the @author tags.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.javamoney.examples.console.java10.core;
/**
* @author Werner Keil
* @version 1.0
*/
public class AmountsDoCalculations {
/**
* @param args
*/
public static void main(String[] args) {
var amount = Monetary.getDefaultAmountFactory().setCurrency("EUR").setNumber(234).create();
| ConsoleUtils.printDetails(amount);
|
moovida/STAGE | eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/ImageDialog.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/ImageServiceHandler.java
// public class ImageServiceHandler implements ServiceHandler {
// public void service( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {
// String id = request.getParameter("imageId");
// BufferedImage image = (BufferedImage) RWT.getUISession().getAttribute(id);
// response.setContentType("image/png");
// ServletOutputStream out = response.getOutputStream();
// ImageIO.write(image, "png", out);
// }
// }
| import java.io.File;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.service.ServiceManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import eu.hydrologis.stage.libs.utilsrap.ImageServiceHandler; | package eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils;
public class ImageDialog extends Dialog {
private final static String SERVICE_HANDLER = "imageServiceHandler4dialog";
private final static String IMAGE_KEY = "imageKey4dialog";
static {
// register the service handler
try { | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/ImageServiceHandler.java
// public class ImageServiceHandler implements ServiceHandler {
// public void service( HttpServletRequest request, HttpServletResponse response ) throws IOException, ServletException {
// String id = request.getParameter("imageId");
// BufferedImage image = (BufferedImage) RWT.getUISession().getAttribute(id);
// response.setContentType("image/png");
// ServletOutputStream out = response.getOutputStream();
// ImageIO.write(image, "png", out);
// }
// }
// Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/ImageDialog.java
import java.io.File;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.service.ServiceManager;
import org.eclipse.swt.SWT;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Shell;
import eu.hydrologis.stage.libs.utilsrap.ImageServiceHandler;
package eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils;
public class ImageDialog extends Dialog {
private final static String SERVICE_HANDLER = "imageServiceHandler4dialog";
private final static String IMAGE_KEY = "imageKey4dialog";
static {
// register the service handler
try { | RWT.getServiceManager().registerServiceHandler(SERVICE_HANDLER, new ImageServiceHandler()); |
moovida/STAGE | eu.hydrologis.stage.application/src/eu/hydrologis/stage/application/StageApplication.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
| import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.application.AbstractEntryPoint;
import org.eclipse.rap.rwt.application.Application;
import org.eclipse.rap.rwt.application.Application.OperationMode;
import org.eclipse.rap.rwt.application.ApplicationConfiguration;
import org.eclipse.rap.rwt.client.WebClient;
import org.eclipse.rap.rwt.service.ResourceLoader;
import org.eclipse.rap.rwt.service.ServiceHandler;
import eu.hydrologis.stage.libs.log.StageLogger; | /*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.application;
public class StageApplication implements ApplicationConfiguration {
public static final String ID = "eu.hydrologis.stage.application.StageApplication";
private static final String ID_SERVICE_HANDLER = "org.eclipse.rap.ui.serviceHandler";
@SuppressWarnings("unchecked")
public void configure( Application application ) {
Map<String, String> stageProperties = new HashMap<String, String>();
stageProperties.put(WebClient.PAGE_TITLE, "S.T.A.G.E.");
stageProperties.put(WebClient.BODY_HTML, readTextFromResource("resources/body.html", "UTF-8"));
stageProperties.put(WebClient.HEAD_HTML, readTextFromResource("resources/head.html", "UTF-8"));
stageProperties.put(WebClient.FAVICON, "resources/favicon.png");
application.addEntryPoint("/", StageEntryPoint.class, stageProperties);
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint("eu.hydrologis.stage.entrypoint");
if (point != null) {
IExtension[] extensions = point.getExtensions();
TreeMap<String, IConfigurationElement> elementsToKeep = new TreeMap<>();
for( IExtension extension : extensions ) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for( IConfigurationElement element : configurationElements ) {
try {
String title = element.getAttribute("title");
elementsToKeep.put(title, element);
} catch (Exception e) { | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
// Path: eu.hydrologis.stage.application/src/eu/hydrologis/stage/application/StageApplication.java
import java.io.BufferedReader;
import java.io.IOException;
import java.io.InputStream;
import java.io.InputStreamReader;
import java.util.HashMap;
import java.util.Map;
import java.util.Map.Entry;
import java.util.TreeMap;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IConfigurationElement;
import org.eclipse.core.runtime.IExtension;
import org.eclipse.core.runtime.IExtensionPoint;
import org.eclipse.core.runtime.IExtensionRegistry;
import org.eclipse.core.runtime.Platform;
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.application.AbstractEntryPoint;
import org.eclipse.rap.rwt.application.Application;
import org.eclipse.rap.rwt.application.Application.OperationMode;
import org.eclipse.rap.rwt.application.ApplicationConfiguration;
import org.eclipse.rap.rwt.client.WebClient;
import org.eclipse.rap.rwt.service.ResourceLoader;
import org.eclipse.rap.rwt.service.ServiceHandler;
import eu.hydrologis.stage.libs.log.StageLogger;
/*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.application;
public class StageApplication implements ApplicationConfiguration {
public static final String ID = "eu.hydrologis.stage.application.StageApplication";
private static final String ID_SERVICE_HANDLER = "org.eclipse.rap.ui.serviceHandler";
@SuppressWarnings("unchecked")
public void configure( Application application ) {
Map<String, String> stageProperties = new HashMap<String, String>();
stageProperties.put(WebClient.PAGE_TITLE, "S.T.A.G.E.");
stageProperties.put(WebClient.BODY_HTML, readTextFromResource("resources/body.html", "UTF-8"));
stageProperties.put(WebClient.HEAD_HTML, readTextFromResource("resources/head.html", "UTF-8"));
stageProperties.put(WebClient.FAVICON, "resources/favicon.png");
application.addEntryPoint("/", StageEntryPoint.class, stageProperties);
IExtensionRegistry registry = Platform.getExtensionRegistry();
IExtensionPoint point = registry.getExtensionPoint("eu.hydrologis.stage.entrypoint");
if (point != null) {
IExtension[] extensions = point.getExtensions();
TreeMap<String, IConfigurationElement> elementsToKeep = new TreeMap<>();
for( IExtension extension : extensions ) {
IConfigurationElement[] configurationElements = extension.getConfigurationElements();
for( IConfigurationElement element : configurationElements ) {
try {
String title = element.getAttribute("title");
elementsToKeep.put(title, element);
} catch (Exception e) { | StageLogger.logError(this, e); |
moovida/STAGE | eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/workspace/User.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/LoginDialog.java
// public class LoginDialog extends Dialog {
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// private static final String LOGINMESSAGE = "Please sign in with your username and password:";
// private static final String LOGIN = "Login";
// private static final String CANCEL = "Cancel";
// private static final String PASSWORD = "Password:";
// private static final String USERNAME = "Username:";
//
// private static final int LOGIN_ID = IDialogConstants.CLIENT_ID + 1;
// private Text userText;
// private Text passText;
// private Label mesgLabel;
// private final String title;
// private final String message;
// private String username;
// private String password;
//
// public LoginDialog( Shell parent, String title, String message ) {
// super(parent);
// this.title = title;
// this.message = message;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setUsername( String username ) {
// this.username = username;
// }
//
// public String getUsername() {
// return username;
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(2, false));
// mesgLabel = new Label(composite, SWT.NONE);
// GridData messageData = new GridData(SWT.FILL, SWT.CENTER, true, false);
// messageData.horizontalSpan = 2;
// mesgLabel.setLayoutData(messageData);
// Label userLabel = new Label(composite, SWT.NONE);
// userLabel.setText(USERNAME);
// userText = new Text(composite, SWT.BORDER);
// userText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Label passLabel = new Label(composite, SWT.NONE);
// passLabel.setText(PASSWORD);
// passText = new Text(composite, SWT.BORDER | SWT.PASSWORD);
// passText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// initilizeDialogArea();
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// createButton(parent, LOGIN_ID, LOGIN, true);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// if (buttonId == LOGIN_ID) {
// username = userText.getText();
// password = passText.getText();
// setReturnCode(OK);
// close();
// } else {
// password = null;
// }
// super.buttonPressed(buttonId);
// }
//
// private void initilizeDialogArea() {
// if (message != null) {
// mesgLabel.setText(message);
// }
// if (username != null) {
// userText.setText(username);
// }
// userText.setFocus();
// }
//
// /**
// * Show login screen and check pwd.
// *
// * <p>Dummy implementation.
// *
// * @param shell
// * @return the {@link User} or <code>null</code>.
// */
// public static boolean checkUserLogin( Shell shell ) {
// HttpSession httpSession = RWT.getUISession().getHttpSession();
// Object attribute = httpSession.getAttribute(SESSION_USER_KEY);
// if (attribute instanceof String) {
// return true;
// } else {
// String message = LOGINMESSAGE;
// final LoginDialog loginDialog = new LoginDialog(shell, LOGIN, message);
// loginDialog.setUsername(LoginChecker.TESTUSER);
// int returnCode = loginDialog.open();
// if (returnCode == Window.OK) {
// String username = loginDialog.getUsername();
// String password = loginDialog.getPassword();
// if (LoginChecker.isLoginOk(username, password)) {
// httpSession.setAttribute(SESSION_USER_KEY, username);
//
// try {
// StageWorkspace.getInstance().getDataFolder(username);
// StageWorkspace.getInstance().getScriptsFolder(username);
// StageWorkspace.getInstance().getGeopaparazziFolder(username);
// } catch (Exception e) {
// e.printStackTrace();
// MessageDialogUtil.openError(shell, "Error", "An error occurred while trying to access the workspace.",
// null);
// }
// return true;
// }
// }
// return false;
// }
// }
//
// }
| import javax.servlet.http.HttpSession;
import org.eclipse.rap.rwt.RWT;
import eu.hydrologis.stage.libs.utilsrap.LoginDialog; | /*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.libs.workspace;
/**
* @author Andrea Antonello (www.hydrologis.com)
*
*/
public class User {
private String name;
public User( String name ) {
this.name = name;
}
public String getName() {
return name;
}
/**
* @return the name of the current session user.
*/
public static String getCurrentUserName() {
HttpSession httpSession = RWT.getUISession().getHttpSession(); | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/LoginDialog.java
// public class LoginDialog extends Dialog {
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// private static final String LOGINMESSAGE = "Please sign in with your username and password:";
// private static final String LOGIN = "Login";
// private static final String CANCEL = "Cancel";
// private static final String PASSWORD = "Password:";
// private static final String USERNAME = "Username:";
//
// private static final int LOGIN_ID = IDialogConstants.CLIENT_ID + 1;
// private Text userText;
// private Text passText;
// private Label mesgLabel;
// private final String title;
// private final String message;
// private String username;
// private String password;
//
// public LoginDialog( Shell parent, String title, String message ) {
// super(parent);
// this.title = title;
// this.message = message;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setUsername( String username ) {
// this.username = username;
// }
//
// public String getUsername() {
// return username;
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(2, false));
// mesgLabel = new Label(composite, SWT.NONE);
// GridData messageData = new GridData(SWT.FILL, SWT.CENTER, true, false);
// messageData.horizontalSpan = 2;
// mesgLabel.setLayoutData(messageData);
// Label userLabel = new Label(composite, SWT.NONE);
// userLabel.setText(USERNAME);
// userText = new Text(composite, SWT.BORDER);
// userText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Label passLabel = new Label(composite, SWT.NONE);
// passLabel.setText(PASSWORD);
// passText = new Text(composite, SWT.BORDER | SWT.PASSWORD);
// passText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// initilizeDialogArea();
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// createButton(parent, LOGIN_ID, LOGIN, true);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// if (buttonId == LOGIN_ID) {
// username = userText.getText();
// password = passText.getText();
// setReturnCode(OK);
// close();
// } else {
// password = null;
// }
// super.buttonPressed(buttonId);
// }
//
// private void initilizeDialogArea() {
// if (message != null) {
// mesgLabel.setText(message);
// }
// if (username != null) {
// userText.setText(username);
// }
// userText.setFocus();
// }
//
// /**
// * Show login screen and check pwd.
// *
// * <p>Dummy implementation.
// *
// * @param shell
// * @return the {@link User} or <code>null</code>.
// */
// public static boolean checkUserLogin( Shell shell ) {
// HttpSession httpSession = RWT.getUISession().getHttpSession();
// Object attribute = httpSession.getAttribute(SESSION_USER_KEY);
// if (attribute instanceof String) {
// return true;
// } else {
// String message = LOGINMESSAGE;
// final LoginDialog loginDialog = new LoginDialog(shell, LOGIN, message);
// loginDialog.setUsername(LoginChecker.TESTUSER);
// int returnCode = loginDialog.open();
// if (returnCode == Window.OK) {
// String username = loginDialog.getUsername();
// String password = loginDialog.getPassword();
// if (LoginChecker.isLoginOk(username, password)) {
// httpSession.setAttribute(SESSION_USER_KEY, username);
//
// try {
// StageWorkspace.getInstance().getDataFolder(username);
// StageWorkspace.getInstance().getScriptsFolder(username);
// StageWorkspace.getInstance().getGeopaparazziFolder(username);
// } catch (Exception e) {
// e.printStackTrace();
// MessageDialogUtil.openError(shell, "Error", "An error occurred while trying to access the workspace.",
// null);
// }
// return true;
// }
// }
// return false;
// }
// }
//
// }
// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/workspace/User.java
import javax.servlet.http.HttpSession;
import org.eclipse.rap.rwt.RWT;
import eu.hydrologis.stage.libs.utilsrap.LoginDialog;
/*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.libs.workspace;
/**
* @author Andrea Antonello (www.hydrologis.com)
*
*/
public class User {
private String name;
public User( String name ) {
this.name = name;
}
public String getName() {
return name;
}
/**
* @return the name of the current session user.
*/
public static String getCurrentUserName() {
HttpSession httpSession = RWT.getUISession().getHttpSession(); | Object attribute = httpSession.getAttribute(LoginDialog.SESSION_USER_KEY); |
moovida/STAGE | eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/StageLibsActivator.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
| import java.io.File;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import eu.hydrologis.stage.libs.log.StageLogger; | package eu.hydrologis.stage.libs;
public class StageLibsActivator implements BundleActivator {
private static File bundleFile;
/**
* The java -D commandline property that defines the workspace.
*/
private static final String STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY = "stage.javaexec";
private static File geotoolsLibsFolder;
private static File spatialToolboxFolder;
private static File stageJavaExecFile;
@Override
public void start( BundleContext context ) throws Exception {
Bundle bundle = context.getBundle();
bundleFile = FileLocator.getBundleFile(bundle);
| // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/StageLibsActivator.java
import java.io.File;
import org.eclipse.core.runtime.FileLocator;
import org.osgi.framework.Bundle;
import org.osgi.framework.BundleActivator;
import org.osgi.framework.BundleContext;
import eu.hydrologis.stage.libs.log.StageLogger;
package eu.hydrologis.stage.libs;
public class StageLibsActivator implements BundleActivator {
private static File bundleFile;
/**
* The java -D commandline property that defines the workspace.
*/
private static final String STAGE_JAVAEXEC_JAVA_PROPERTIES_KEY = "stage.javaexec";
private static File geotoolsLibsFolder;
private static File spatialToolboxFolder;
private static File stageJavaExecFile;
@Override
public void start( BundleContext context ) throws Exception {
Bundle bundle = context.getBundle();
bundleFile = FileLocator.getBundleFile(bundle);
| StageLogger.logInfo(this, "Libs bundle file: " + bundleFile.getAbsolutePath()); |
moovida/STAGE | eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/MetadataEditDialog.java | // Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/ProjectInfo.java
// public class ProjectInfo {
// public File databaseFile;
// public String fileName;
// public String metadata;
//
// public Image[] images;
// public List<GpsLog> logs;
// }
| import static org.jgrasstools.gears.io.geopaparazzi.geopap4.TableDescriptions.TABLE_METADATA;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jgrasstools.dbs.compat.IJGTConnection;
import org.jgrasstools.dbs.compat.IJGTStatement;
import org.jgrasstools.dbs.spatialite.jgt.SqliteDb;
import org.jgrasstools.gears.io.geopaparazzi.geopap4.TableDescriptions.MetadataTableFields;
import eu.hydrologis.stage.geopaparazzi.geopapbrowser.ProjectInfo; | package eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils;
public class MetadataEditDialog extends Dialog {
private static final long serialVersionUID = 1L;
// private static final String CANCEL = "Cancel";
private final String title;
private File dbFile;
private static final String OK = "Ok";
private static final String CANCEL = "Cancel";
private LinkedHashMap<String, String> metadataMap;
private List<Text> textWidgets = new ArrayList<Text>();
| // Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/ProjectInfo.java
// public class ProjectInfo {
// public File databaseFile;
// public String fileName;
// public String metadata;
//
// public Image[] images;
// public List<GpsLog> logs;
// }
// Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/MetadataEditDialog.java
import static org.jgrasstools.gears.io.geopaparazzi.geopap4.TableDescriptions.TABLE_METADATA;
import java.io.File;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.jface.dialogs.Dialog;
import org.eclipse.jface.dialogs.IDialogConstants;
import org.eclipse.swt.SWT;
import org.eclipse.swt.custom.ScrolledComposite;
import org.eclipse.swt.events.ControlAdapter;
import org.eclipse.swt.events.ControlEvent;
import org.eclipse.swt.graphics.Point;
import org.eclipse.swt.graphics.Rectangle;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.layout.GridLayout;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Control;
import org.eclipse.swt.widgets.Group;
import org.eclipse.swt.widgets.Shell;
import org.eclipse.swt.widgets.Text;
import org.jgrasstools.dbs.compat.IJGTConnection;
import org.jgrasstools.dbs.compat.IJGTStatement;
import org.jgrasstools.dbs.spatialite.jgt.SqliteDb;
import org.jgrasstools.gears.io.geopaparazzi.geopap4.TableDescriptions.MetadataTableFields;
import eu.hydrologis.stage.geopaparazzi.geopapbrowser.ProjectInfo;
package eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils;
public class MetadataEditDialog extends Dialog {
private static final long serialVersionUID = 1L;
// private static final String CANCEL = "Cancel";
private final String title;
private File dbFile;
private static final String OK = "Ok";
private static final String CANCEL = "Cancel";
private LinkedHashMap<String, String> metadataMap;
private List<Text> textWidgets = new ArrayList<Text>();
| private ProjectInfo selectedProject; |
moovida/STAGE | eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utils/ImageCache.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/ImageUtil.java
// public class ImageUtil {
//
// public static Image getImage( Display display, String path ) {
// ClassLoader classLoader = ImageUtil.class.getClassLoader();
// InputStream inputStream = classLoader.getResourceAsStream( "resources/" + path );
// Image result = null;
// if( inputStream != null ) {
// try {
// result = new Image( display, inputStream );
// } finally {
// try {
// inputStream.close();
// } catch( IOException e ) {
// // ignore
// }
// }
// }
// return result;
// }
//
// private ImageUtil() {
// // prevent instantiation
// }
//
// }
| import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import eu.hydrologis.stage.libs.utilsrap.ImageUtil; | }
public static ImageCache getInstance() {
if (imageCache == null) {
imageCache = new ImageCache();
}
return imageCache;
}
/**
* Get an image for a certain key.
*
* <p>
* <b>The only keys to be used are the static strings in this class!!</b>
* </p>
*
* @param key
* a file key, as for example {@link ImageCache#DATABASE_VIEW}.
* @return the image.
*/
public Image getImage(Display display, String key) {
Image image = imageMap.get(key);
if (image == null) {
image = createImage(display, key);
imageMap.put(key, image);
}
return image;
}
private Image createImage(Display display, String key) { | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/ImageUtil.java
// public class ImageUtil {
//
// public static Image getImage( Display display, String path ) {
// ClassLoader classLoader = ImageUtil.class.getClassLoader();
// InputStream inputStream = classLoader.getResourceAsStream( "resources/" + path );
// Image result = null;
// if( inputStream != null ) {
// try {
// result = new Image( display, inputStream );
// } finally {
// try {
// inputStream.close();
// } catch( IOException e ) {
// // ignore
// }
// }
// }
// return result;
// }
//
// private ImageUtil() {
// // prevent instantiation
// }
//
// }
// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utils/ImageCache.java
import java.util.HashMap;
import java.util.Map.Entry;
import java.util.Set;
import org.eclipse.swt.graphics.Image;
import org.eclipse.swt.widgets.Display;
import eu.hydrologis.stage.libs.utilsrap.ImageUtil;
}
public static ImageCache getInstance() {
if (imageCache == null) {
imageCache = new ImageCache();
}
return imageCache;
}
/**
* Get an image for a certain key.
*
* <p>
* <b>The only keys to be used are the static strings in this class!!</b>
* </p>
*
* @param key
* a file key, as for example {@link ImageCache#DATABASE_VIEW}.
* @return the image.
*/
public Image getImage(Display display, String key) {
Image image = imageMap.get(key);
if (image == null) {
image = createImage(display, key);
imageMap.put(key, image);
}
return image;
}
private Image createImage(Display display, String key) { | Image image = ImageUtil.getImage(display, key); |
moovida/STAGE | eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/GeopapBrowserEntryPoint.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/LoginDialog.java
// public class LoginDialog extends Dialog {
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// private static final String LOGINMESSAGE = "Please sign in with your username and password:";
// private static final String LOGIN = "Login";
// private static final String CANCEL = "Cancel";
// private static final String PASSWORD = "Password:";
// private static final String USERNAME = "Username:";
//
// private static final int LOGIN_ID = IDialogConstants.CLIENT_ID + 1;
// private Text userText;
// private Text passText;
// private Label mesgLabel;
// private final String title;
// private final String message;
// private String username;
// private String password;
//
// public LoginDialog( Shell parent, String title, String message ) {
// super(parent);
// this.title = title;
// this.message = message;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setUsername( String username ) {
// this.username = username;
// }
//
// public String getUsername() {
// return username;
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(2, false));
// mesgLabel = new Label(composite, SWT.NONE);
// GridData messageData = new GridData(SWT.FILL, SWT.CENTER, true, false);
// messageData.horizontalSpan = 2;
// mesgLabel.setLayoutData(messageData);
// Label userLabel = new Label(composite, SWT.NONE);
// userLabel.setText(USERNAME);
// userText = new Text(composite, SWT.BORDER);
// userText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Label passLabel = new Label(composite, SWT.NONE);
// passLabel.setText(PASSWORD);
// passText = new Text(composite, SWT.BORDER | SWT.PASSWORD);
// passText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// initilizeDialogArea();
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// createButton(parent, LOGIN_ID, LOGIN, true);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// if (buttonId == LOGIN_ID) {
// username = userText.getText();
// password = passText.getText();
// setReturnCode(OK);
// close();
// } else {
// password = null;
// }
// super.buttonPressed(buttonId);
// }
//
// private void initilizeDialogArea() {
// if (message != null) {
// mesgLabel.setText(message);
// }
// if (username != null) {
// userText.setText(username);
// }
// userText.setFocus();
// }
//
// /**
// * Show login screen and check pwd.
// *
// * <p>Dummy implementation.
// *
// * @param shell
// * @return the {@link User} or <code>null</code>.
// */
// public static boolean checkUserLogin( Shell shell ) {
// HttpSession httpSession = RWT.getUISession().getHttpSession();
// Object attribute = httpSession.getAttribute(SESSION_USER_KEY);
// if (attribute instanceof String) {
// return true;
// } else {
// String message = LOGINMESSAGE;
// final LoginDialog loginDialog = new LoginDialog(shell, LOGIN, message);
// loginDialog.setUsername(LoginChecker.TESTUSER);
// int returnCode = loginDialog.open();
// if (returnCode == Window.OK) {
// String username = loginDialog.getUsername();
// String password = loginDialog.getPassword();
// if (LoginChecker.isLoginOk(username, password)) {
// httpSession.setAttribute(SESSION_USER_KEY, username);
//
// try {
// StageWorkspace.getInstance().getDataFolder(username);
// StageWorkspace.getInstance().getScriptsFolder(username);
// StageWorkspace.getInstance().getGeopaparazziFolder(username);
// } catch (Exception e) {
// e.printStackTrace();
// MessageDialogUtil.openError(shell, "Error", "An error occurred while trying to access the workspace.",
// null);
// }
// return true;
// }
// }
// return false;
// }
// }
//
// }
| import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.application.AbstractEntryPoint;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import eu.hydrologis.stage.libs.utilsrap.LoginDialog; | /*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.geopaparazzi.geopapbrowser;
public class GeopapBrowserEntryPoint extends AbstractEntryPoint {
@Override
protected void createContents( final Composite parent ) {
// Login screen | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/utilsrap/LoginDialog.java
// public class LoginDialog extends Dialog {
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// private static final String LOGINMESSAGE = "Please sign in with your username and password:";
// private static final String LOGIN = "Login";
// private static final String CANCEL = "Cancel";
// private static final String PASSWORD = "Password:";
// private static final String USERNAME = "Username:";
//
// private static final int LOGIN_ID = IDialogConstants.CLIENT_ID + 1;
// private Text userText;
// private Text passText;
// private Label mesgLabel;
// private final String title;
// private final String message;
// private String username;
// private String password;
//
// public LoginDialog( Shell parent, String title, String message ) {
// super(parent);
// this.title = title;
// this.message = message;
// }
//
// public String getPassword() {
// return password;
// }
//
// public void setUsername( String username ) {
// this.username = username;
// }
//
// public String getUsername() {
// return username;
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(2, false));
// mesgLabel = new Label(composite, SWT.NONE);
// GridData messageData = new GridData(SWT.FILL, SWT.CENTER, true, false);
// messageData.horizontalSpan = 2;
// mesgLabel.setLayoutData(messageData);
// Label userLabel = new Label(composite, SWT.NONE);
// userLabel.setText(USERNAME);
// userText = new Text(composite, SWT.BORDER);
// userText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// Label passLabel = new Label(composite, SWT.NONE);
// passLabel.setText(PASSWORD);
// passText = new Text(composite, SWT.BORDER | SWT.PASSWORD);
// passText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false));
// initilizeDialogArea();
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// createButton(parent, LOGIN_ID, LOGIN, true);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// if (buttonId == LOGIN_ID) {
// username = userText.getText();
// password = passText.getText();
// setReturnCode(OK);
// close();
// } else {
// password = null;
// }
// super.buttonPressed(buttonId);
// }
//
// private void initilizeDialogArea() {
// if (message != null) {
// mesgLabel.setText(message);
// }
// if (username != null) {
// userText.setText(username);
// }
// userText.setFocus();
// }
//
// /**
// * Show login screen and check pwd.
// *
// * <p>Dummy implementation.
// *
// * @param shell
// * @return the {@link User} or <code>null</code>.
// */
// public static boolean checkUserLogin( Shell shell ) {
// HttpSession httpSession = RWT.getUISession().getHttpSession();
// Object attribute = httpSession.getAttribute(SESSION_USER_KEY);
// if (attribute instanceof String) {
// return true;
// } else {
// String message = LOGINMESSAGE;
// final LoginDialog loginDialog = new LoginDialog(shell, LOGIN, message);
// loginDialog.setUsername(LoginChecker.TESTUSER);
// int returnCode = loginDialog.open();
// if (returnCode == Window.OK) {
// String username = loginDialog.getUsername();
// String password = loginDialog.getPassword();
// if (LoginChecker.isLoginOk(username, password)) {
// httpSession.setAttribute(SESSION_USER_KEY, username);
//
// try {
// StageWorkspace.getInstance().getDataFolder(username);
// StageWorkspace.getInstance().getScriptsFolder(username);
// StageWorkspace.getInstance().getGeopaparazziFolder(username);
// } catch (Exception e) {
// e.printStackTrace();
// MessageDialogUtil.openError(shell, "Error", "An error occurred while trying to access the workspace.",
// null);
// }
// return true;
// }
// }
// return false;
// }
// }
//
// }
// Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/GeopapBrowserEntryPoint.java
import org.eclipse.rap.rwt.RWT;
import org.eclipse.rap.rwt.application.AbstractEntryPoint;
import org.eclipse.swt.SWT;
import org.eclipse.swt.layout.GridData;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Label;
import eu.hydrologis.stage.libs.utilsrap.LoginDialog;
/*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.geopaparazzi.geopapbrowser;
public class GeopapBrowserEntryPoint extends AbstractEntryPoint {
@Override
protected void createContents( final Composite parent ) {
// Login screen | if (!LoginDialog.checkUserLogin(getShell())) { |
moovida/STAGE | eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/functions/OpenImageFunction.java | // Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/ImageDialog.java
// public class ImageDialog extends Dialog {
//
// private final static String SERVICE_HANDLER = "imageServiceHandler4dialog";
// private final static String IMAGE_KEY = "imageKey4dialog";
// static {
// // register the service handler
// try {
// RWT.getServiceManager().registerServiceHandler(SERVICE_HANDLER, new ImageServiceHandler());
// } catch (Exception e1) {
// e1.printStackTrace();
// }
// }
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// // private static final String CANCEL = "Cancel";
// private final String title;
// private long imageId;
// private File dbFile;
// private String imageName;
//
// public ImageDialog( Shell parent, String title, File dbFile, long imageId, String imageName ) {
// super(parent);
// this.title = title;
// this.dbFile = dbFile;
// this.imageId = imageId;
// this.imageName = imageName;
//
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(1, false));
//
// Browser imageBrowser = new Browser(composite, SWT.NONE);
// imageBrowser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//
// try {
// GeopaparazziUtilities.setImageInBrowser(imageBrowser, imageId, imageName, dbFile, IMAGE_KEY, SERVICE_HANDLER);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// // createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// super.buttonPressed(buttonId);
// }
//
// @Override
// protected Point getInitialSize() {
// return new Point(800, 800);
// }
//
// @Override
// public boolean close() {
// return super.close();
// }
//
// }
| import java.io.File;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils.ImageDialog; | /*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.geopaparazzi.geopapbrowser.functions;
public class OpenImageFunction extends BrowserFunction {
private Browser browser;
private File databaseFile;
public OpenImageFunction( Browser browser, String name, File databaseFile ) {
super(browser, name);
this.browser = browser;
this.databaseFile = databaseFile;
}
@Override
public Object function( Object[] arguments ) {
String imageId = arguments[0].toString();
String imageName = arguments[1].toString();
long id = (long) Double.parseDouble(imageId); | // Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/utils/ImageDialog.java
// public class ImageDialog extends Dialog {
//
// private final static String SERVICE_HANDLER = "imageServiceHandler4dialog";
// private final static String IMAGE_KEY = "imageKey4dialog";
// static {
// // register the service handler
// try {
// RWT.getServiceManager().registerServiceHandler(SERVICE_HANDLER, new ImageServiceHandler());
// } catch (Exception e1) {
// e1.printStackTrace();
// }
// }
//
// public static final String SESSION_USER_KEY = "SESSION_USER";
//
// private static final long serialVersionUID = 1L;
//
// // private static final String CANCEL = "Cancel";
// private final String title;
// private long imageId;
// private File dbFile;
// private String imageName;
//
// public ImageDialog( Shell parent, String title, File dbFile, long imageId, String imageName ) {
// super(parent);
// this.title = title;
// this.dbFile = dbFile;
// this.imageId = imageId;
// this.imageName = imageName;
//
// }
//
// @Override
// protected void configureShell( Shell shell ) {
// super.configureShell(shell);
// if (title != null) {
// shell.setText(title);
// }
// }
//
// @Override
// protected Control createDialogArea( Composite parent ) {
// Composite composite = (Composite) super.createDialogArea(parent);
// composite.setLayout(new GridLayout(1, false));
//
// Browser imageBrowser = new Browser(composite, SWT.NONE);
// imageBrowser.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true));
//
// try {
// GeopaparazziUtilities.setImageInBrowser(imageBrowser, imageId, imageName, dbFile, IMAGE_KEY, SERVICE_HANDLER);
// } catch (Exception e) {
// e.printStackTrace();
// }
// return composite;
// }
//
// @Override
// protected void createButtonsForButtonBar( Composite parent ) {
// // createButton(parent, IDialogConstants.CANCEL_ID, CANCEL, false);
// }
//
// @Override
// protected void buttonPressed( int buttonId ) {
// super.buttonPressed(buttonId);
// }
//
// @Override
// protected Point getInitialSize() {
// return new Point(800, 800);
// }
//
// @Override
// public boolean close() {
// return super.close();
// }
//
// }
// Path: eu.hydrologis.stage.geopaparazzi/src/eu/hydrologis/stage/geopaparazzi/geopapbrowser/functions/OpenImageFunction.java
import java.io.File;
import org.eclipse.swt.browser.Browser;
import org.eclipse.swt.browser.BrowserFunction;
import eu.hydrologis.stage.geopaparazzi.geopapbrowser.utils.ImageDialog;
/*
* Stage - Spatial Toolbox And Geoscript Environment
* (C) HydroloGIS - www.hydrologis.com
*
* All rights reserved. This program and the accompanying materials
* are made available under the terms of the Eclipse Public License v1.0
* (http://www.eclipse.org/legal/epl-v10.html).
*/
package eu.hydrologis.stage.geopaparazzi.geopapbrowser.functions;
public class OpenImageFunction extends BrowserFunction {
private Browser browser;
private File databaseFile;
public OpenImageFunction( Browser browser, String name, File databaseFile ) {
super(browser, name);
this.browser = browser;
this.databaseFile = databaseFile;
}
@Override
public Object function( Object[] arguments ) {
String imageId = arguments[0].toString();
String imageName = arguments[1].toString();
long id = (long) Double.parseDouble(imageId); | ImageDialog imageDialog = new ImageDialog(browser.getShell(), "Image: " + imageName, databaseFile, id, imageName); |
moovida/STAGE | eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/workspace/StageWorkspace.java | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
| import java.io.File;
import eu.hydrologis.stage.libs.log.StageLogger; | */
private static final String STAGE_WORKSPACE_JAVA_PROPERTIES_KEY = "stage.workspace";
private static final String STAGE_DATAFOLDER_JAVA_PROPERTIES_KEY = "stage.datafolder";
private static final String STAGE_SCRIPTSFOLDER_JAVA_PROPERTIES_KEY = "stage.scriptsfolder";
private static final String STAGE_GEOPAPARAZZIFOLDER_JAVA_PROPERTIES_KEY = "stage.geopaparazzifolder";
private static final String STAGE_ISLOCAL_KEY = "stage.islocal";
private static StageWorkspace stageWorkspace;
private File stageWorkspaceFolder;
private File customDataFolder;
private File customScriptsFolder;
private File customGeopaparazziFolder;
private boolean isLocal = false;
public static StageWorkspace getInstance() {
if (stageWorkspace == null) {
stageWorkspace = new StageWorkspace();
}
return stageWorkspace;
}
private StageWorkspace() {
String stageWorkspacepath = System.getProperty(STAGE_WORKSPACE_JAVA_PROPERTIES_KEY);
if (stageWorkspacepath == null || !new File(stageWorkspacepath).exists()) {
throw new RuntimeException(NO_WORKSPACE_DEFINED);
}
String dataFolderPath = System.getProperty(STAGE_DATAFOLDER_JAVA_PROPERTIES_KEY);
if (dataFolderPath != null && new File(dataFolderPath).exists()) {
customDataFolder = new File(dataFolderPath); | // Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/log/StageLogger.java
// public class StageLogger {
//
// public static final boolean LOG_INFO = true;
// public static final boolean LOG_DEBUG = false;
// public static final boolean LOG_ERROR = true;
//
// private static final String SEP = ":: ";
//
// private static SimpleDateFormat f = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
//
// public static void logInfo( Object owner, String msg ) {
// if (LOG_INFO) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logDebug( Object owner, String msg ) {
// if (LOG_DEBUG) {
// msg = toMessage(owner, msg);
// System.out.println(msg);
// }
// }
//
// public static void logError( Object owner, String msg, Throwable e ) {
// if (LOG_ERROR) {
// msg = toMessage(owner, msg);
// System.err.println(msg);
// e.printStackTrace();
// }
// }
//
// public static void logError( Object owner, Throwable e ) {
// logError(owner, null, e);
// }
//
// private static String toMessage( Object owner, String msg ) {
// if (msg == null)
// msg = "";
// String newMsg = f.format(new Date()) + SEP;
// if (owner instanceof String) {
// newMsg = newMsg + owner + SEP;
// } else {
// newMsg = newMsg + owner.getClass().getSimpleName() + SEP;
// }
// newMsg = newMsg + msg;
// return newMsg;
// }
//
// }
// Path: eu.hydrologis.stage.libs/src/eu/hydrologis/stage/libs/workspace/StageWorkspace.java
import java.io.File;
import eu.hydrologis.stage.libs.log.StageLogger;
*/
private static final String STAGE_WORKSPACE_JAVA_PROPERTIES_KEY = "stage.workspace";
private static final String STAGE_DATAFOLDER_JAVA_PROPERTIES_KEY = "stage.datafolder";
private static final String STAGE_SCRIPTSFOLDER_JAVA_PROPERTIES_KEY = "stage.scriptsfolder";
private static final String STAGE_GEOPAPARAZZIFOLDER_JAVA_PROPERTIES_KEY = "stage.geopaparazzifolder";
private static final String STAGE_ISLOCAL_KEY = "stage.islocal";
private static StageWorkspace stageWorkspace;
private File stageWorkspaceFolder;
private File customDataFolder;
private File customScriptsFolder;
private File customGeopaparazziFolder;
private boolean isLocal = false;
public static StageWorkspace getInstance() {
if (stageWorkspace == null) {
stageWorkspace = new StageWorkspace();
}
return stageWorkspace;
}
private StageWorkspace() {
String stageWorkspacepath = System.getProperty(STAGE_WORKSPACE_JAVA_PROPERTIES_KEY);
if (stageWorkspacepath == null || !new File(stageWorkspacepath).exists()) {
throw new RuntimeException(NO_WORKSPACE_DEFINED);
}
String dataFolderPath = System.getProperty(STAGE_DATAFOLDER_JAVA_PROPERTIES_KEY);
if (dataFolderPath != null && new File(dataFolderPath).exists()) {
customDataFolder = new File(dataFolderPath); | StageLogger.logInfo(this, "Custom data folder in use: " + customDataFolder); |
NamelessMC/Nameless-Plugin | src/com/namelessmc/plugin/common/command/UserInfoCommand.java | // Path: src/com/namelessmc/plugin/common/CommonObjectsProvider.java
// public interface CommonObjectsProvider {
//
// AbstractScheduler getScheduler();
//
// LanguageHandler getLanguage();
//
// ApiProvider getApiProvider();
//
// AudienceProvider adventure();
//
// ExceptionLogger getExceptionLogger();
//
// }
//
// Path: src/com/namelessmc/plugin/common/LanguageHandler.java
// public enum Term {
//
// PLAYER_OTHER_NOTFOUND("player.other.not-found"),
// PLAYER_OTHER_NOTREGISTERED("player.other.not-registered"),
// PLAYER_SELF_NOTREGISTERED("player.self.not-registered"),
// PLAYER_SELF_COMMAND_BANNED("player.self.command-banned"),
//
// COMMAND_NOTAPLAYER("command.not-a-player"),
// COMMAND_NO_PERMISSION("command.no-permission"),
//
// COMMAND_NOTIFICATIONS_USAGE("command.notifications.usage"),
// COMMAND_NOTIFICATIONS_DESCRIPTION("command.notifications.description"),
// COMMAND_NOTIFICATIONS_OUTPUT_NO_NOTIFICATIONS("command.notifications.output.no-notifications"),
// COMMAND_NOTIFICATIONS_OUTPUT_NOTIFICATION("command.notifications.output.notification"),
// COMMAND_NOTIFICATIONS_OUTPUT_FAIL("command.notifications.output.fail"),
//
// COMMAND_REGISTER_USAGE("command.register.usage"),
// COMMAND_REGISTER_DESCRIPTION("command.register.description"),
// COMMAND_REGISTER_OUTPUT_SUCCESS_EMAIL("command.register.output.success.email"),
// COMMAND_REGISTER_OUTPUT_SUCCESS_LINK("command.register.output.success.link"),
// COMMAND_REGISTER_OUTPUT_FAIL_GENERIC("command.register.output.fail.generic"),
// COMMAND_REGISTER_OUTPUT_FAIL_ALREADYEXISTS("command.register.output.fail.already-exists"),
// COMMAND_REGISTER_OUTPUT_FAIL_EMAILUSED("command.register.output.fail.email-used"),
// COMMAND_REGISTER_OUTPUT_FAIL_EMAILINVALID("command.register.output.fail.email-invalid"),
// COMMAND_REGISTER_OUTPUT_FAIL_USERNAMEINVALID("command.register.output.fail.username-invalid"),
// COMMAND_REGISTER_OUTPUT_FAIL_CANNOTSENDEMAIL("command.register.output.fail.cannot-send-email"),
//
// COMMAND_REPORT_USAGE("command.report.usage"),
// COMMAND_REPORT_DESCRIPTION("command.report.description"),
// COMMAND_REPORT_OUTPUT_SUCCESS("command.report.output.success"),
// COMMAND_REPORT_OUTPUT_FAIL_GENERIC("command.report.output.fail.generic"),
// COMMAND_REPORT_OUTPUT_FAIL_ALREADY_OPEN("command.report.output.fail.already-open"),
// COMMAND_REPORT_OUTPUT_FAIL_REPORT_SELF("command.report.output.fail.report-self"),
//
// COMMAND_VALIDATE_USAGE("command.validate.usage"),
// COMMAND_VALIDATE_DESCRIPTION("command.validate.description"),
// COMMAND_VALIDATE_OUTPUT_SUCCESS("command.validate.output.success"),
// COMMAND_VALIDATE_OUTPUT_FAIL_INVALIDCODE("command.validate.output.fail.invalid-code"),
// COMMAND_VALIDATE_OUTPUT_FAIL_ALREADYVALIDATED("command.validate.output.fail.already-validated"),
// COMMAND_VALIDATE_OUTPUT_FAIL_GENERIC("command.validate.output.fail.generic"),
//
// COMMAND_USERINFO_USAGE("command.user-info.usage"),
// COMMAND_USERINFO_DESCRIPTION("command.user-info.description"),
// COMMAND_USERINFO_OUTPUT_USERNAME("command.user-info.output.username"),
// COMMAND_USERINFO_OUTPUT_DISPLAYNAME("command.user-info.output.displayname"),
// COMMAND_USERINFO_OUTPUT_UUID("command.user-info.output.uuid"),
// COMMAND_USERINFO_OUTPUT_UUID_UNKNOWN("command.user-info.output.uuid-unknown"),
// COMMAND_USERINFO_OUTPUT_PRIMARY_GROUP("command.user-info.output.primary-group"),
// COMMAND_USERINFO_OUTPUT_ALL_GROUPS("command.user-info.output.all-groups"),
// COMMAND_USERINFO_OUTPUT_REGISTERDATE("command.user-info.output.registered-date"),
// COMMAND_USERINFO_OUTPUT_VALIDATED("command.user-info.output.validated"),
// COMMAND_USERINFO_OUTPUT_BANNED("command.user-info.output.banned"),
// COMMAND_USERINFO_OUTPUT_CUSTOM_FIELD("command.user-info.output.custom-field"),
// COMMAND_USERINFO_OUTPUT_YES("command.user-info.output.yes"),
// COMMAND_USERINFO_OUTPUT_NO("command.user-info.output.no"),
// COMMAND_USERINFO_OUTPUT_FAIL("command.user-info.output.fail"),
//
// JOIN_NOTREGISTERED("join-not-registered"),
// WEBSITE_ANNOUNCEMENT("website-announcement"),
// USER_SYNC_KICK("user-sync-kick"),
//
// ;
//
// private final String path;
//
// Term(final String path) {
// this.path = path;
// }
//
// }
| import com.namelessmc.java_api.*;
import com.namelessmc.plugin.common.CommonObjectsProvider;
import com.namelessmc.plugin.common.LanguageHandler.Term;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors; | package com.namelessmc.plugin.common.command;
public class UserInfoCommand extends CommonCommand {
public UserInfoCommand(final CommonObjectsProvider provider) {
super(provider);
}
@Override
public void execute(final CommandSender sender, final String[] args, final String usage) {
if (args.length == 0) {
if (!sender.isPlayer()) { | // Path: src/com/namelessmc/plugin/common/CommonObjectsProvider.java
// public interface CommonObjectsProvider {
//
// AbstractScheduler getScheduler();
//
// LanguageHandler getLanguage();
//
// ApiProvider getApiProvider();
//
// AudienceProvider adventure();
//
// ExceptionLogger getExceptionLogger();
//
// }
//
// Path: src/com/namelessmc/plugin/common/LanguageHandler.java
// public enum Term {
//
// PLAYER_OTHER_NOTFOUND("player.other.not-found"),
// PLAYER_OTHER_NOTREGISTERED("player.other.not-registered"),
// PLAYER_SELF_NOTREGISTERED("player.self.not-registered"),
// PLAYER_SELF_COMMAND_BANNED("player.self.command-banned"),
//
// COMMAND_NOTAPLAYER("command.not-a-player"),
// COMMAND_NO_PERMISSION("command.no-permission"),
//
// COMMAND_NOTIFICATIONS_USAGE("command.notifications.usage"),
// COMMAND_NOTIFICATIONS_DESCRIPTION("command.notifications.description"),
// COMMAND_NOTIFICATIONS_OUTPUT_NO_NOTIFICATIONS("command.notifications.output.no-notifications"),
// COMMAND_NOTIFICATIONS_OUTPUT_NOTIFICATION("command.notifications.output.notification"),
// COMMAND_NOTIFICATIONS_OUTPUT_FAIL("command.notifications.output.fail"),
//
// COMMAND_REGISTER_USAGE("command.register.usage"),
// COMMAND_REGISTER_DESCRIPTION("command.register.description"),
// COMMAND_REGISTER_OUTPUT_SUCCESS_EMAIL("command.register.output.success.email"),
// COMMAND_REGISTER_OUTPUT_SUCCESS_LINK("command.register.output.success.link"),
// COMMAND_REGISTER_OUTPUT_FAIL_GENERIC("command.register.output.fail.generic"),
// COMMAND_REGISTER_OUTPUT_FAIL_ALREADYEXISTS("command.register.output.fail.already-exists"),
// COMMAND_REGISTER_OUTPUT_FAIL_EMAILUSED("command.register.output.fail.email-used"),
// COMMAND_REGISTER_OUTPUT_FAIL_EMAILINVALID("command.register.output.fail.email-invalid"),
// COMMAND_REGISTER_OUTPUT_FAIL_USERNAMEINVALID("command.register.output.fail.username-invalid"),
// COMMAND_REGISTER_OUTPUT_FAIL_CANNOTSENDEMAIL("command.register.output.fail.cannot-send-email"),
//
// COMMAND_REPORT_USAGE("command.report.usage"),
// COMMAND_REPORT_DESCRIPTION("command.report.description"),
// COMMAND_REPORT_OUTPUT_SUCCESS("command.report.output.success"),
// COMMAND_REPORT_OUTPUT_FAIL_GENERIC("command.report.output.fail.generic"),
// COMMAND_REPORT_OUTPUT_FAIL_ALREADY_OPEN("command.report.output.fail.already-open"),
// COMMAND_REPORT_OUTPUT_FAIL_REPORT_SELF("command.report.output.fail.report-self"),
//
// COMMAND_VALIDATE_USAGE("command.validate.usage"),
// COMMAND_VALIDATE_DESCRIPTION("command.validate.description"),
// COMMAND_VALIDATE_OUTPUT_SUCCESS("command.validate.output.success"),
// COMMAND_VALIDATE_OUTPUT_FAIL_INVALIDCODE("command.validate.output.fail.invalid-code"),
// COMMAND_VALIDATE_OUTPUT_FAIL_ALREADYVALIDATED("command.validate.output.fail.already-validated"),
// COMMAND_VALIDATE_OUTPUT_FAIL_GENERIC("command.validate.output.fail.generic"),
//
// COMMAND_USERINFO_USAGE("command.user-info.usage"),
// COMMAND_USERINFO_DESCRIPTION("command.user-info.description"),
// COMMAND_USERINFO_OUTPUT_USERNAME("command.user-info.output.username"),
// COMMAND_USERINFO_OUTPUT_DISPLAYNAME("command.user-info.output.displayname"),
// COMMAND_USERINFO_OUTPUT_UUID("command.user-info.output.uuid"),
// COMMAND_USERINFO_OUTPUT_UUID_UNKNOWN("command.user-info.output.uuid-unknown"),
// COMMAND_USERINFO_OUTPUT_PRIMARY_GROUP("command.user-info.output.primary-group"),
// COMMAND_USERINFO_OUTPUT_ALL_GROUPS("command.user-info.output.all-groups"),
// COMMAND_USERINFO_OUTPUT_REGISTERDATE("command.user-info.output.registered-date"),
// COMMAND_USERINFO_OUTPUT_VALIDATED("command.user-info.output.validated"),
// COMMAND_USERINFO_OUTPUT_BANNED("command.user-info.output.banned"),
// COMMAND_USERINFO_OUTPUT_CUSTOM_FIELD("command.user-info.output.custom-field"),
// COMMAND_USERINFO_OUTPUT_YES("command.user-info.output.yes"),
// COMMAND_USERINFO_OUTPUT_NO("command.user-info.output.no"),
// COMMAND_USERINFO_OUTPUT_FAIL("command.user-info.output.fail"),
//
// JOIN_NOTREGISTERED("join-not-registered"),
// WEBSITE_ANNOUNCEMENT("website-announcement"),
// USER_SYNC_KICK("user-sync-kick"),
//
// ;
//
// private final String path;
//
// Term(final String path) {
// this.path = path;
// }
//
// }
// Path: src/com/namelessmc/plugin/common/command/UserInfoCommand.java
import com.namelessmc.java_api.*;
import com.namelessmc.plugin.common.CommonObjectsProvider;
import com.namelessmc.plugin.common.LanguageHandler.Term;
import java.util.Optional;
import java.util.UUID;
import java.util.stream.Collectors;
package com.namelessmc.plugin.common.command;
public class UserInfoCommand extends CommonCommand {
public UserInfoCommand(final CommonObjectsProvider provider) {
super(provider);
}
@Override
public void execute(final CommandSender sender, final String[] args, final String usage) {
if (args.length == 0) {
if (!sender.isPlayer()) { | sender.sendMessage(getLanguage().getComponent(Term.COMMAND_NOTAPLAYER)); |
NamelessMC/Nameless-Plugin | src/com/namelessmc/plugin/spigot/ServerDataSender.java | // Path: src/com/namelessmc/plugin/spigot/hooks/maintenance/MaintenanceStatusProvider.java
// public interface MaintenanceStatusProvider {
//
// boolean maintenanceEnabled();
//
// }
| import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.namelessmc.java_api.ApiError;
import com.namelessmc.java_api.NamelessException;
import com.namelessmc.plugin.spigot.hooks.maintenance.MaintenanceStatusProvider;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Statistic;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.net.SocketTimeoutException;
import java.util.Arrays; | package com.namelessmc.plugin.spigot;
public class ServerDataSender extends BukkitRunnable {
@Override
public void run() {
final FileConfiguration config = NamelessPlugin.getInstance().getConfig();
final int serverId = config.getInt("server-data-sender.server-id");
final JsonObject data = new JsonObject();
data.addProperty("tps", 20); // TODO Send real TPS
data.addProperty("time", System.currentTimeMillis());
data.addProperty("free-memory", Runtime.getRuntime().freeMemory());
data.addProperty("max-memory", Runtime.getRuntime().maxMemory());
data.addProperty("allocated-memory", Runtime.getRuntime().totalMemory());
data.addProperty("server-id", serverId);
final net.milkbowl.vault.permission.Permission permissions = NamelessPlugin.getInstance().getPermissions();
try {
if (permissions != null) {
final String[] gArray = permissions.getGroups();
final JsonArray groups = new JsonArray(gArray.length);
Arrays.stream(gArray).map(JsonPrimitive::new).forEach(groups::add);
data.add("groups", groups);
}
} catch (final UnsupportedOperationException ignored) {}
| // Path: src/com/namelessmc/plugin/spigot/hooks/maintenance/MaintenanceStatusProvider.java
// public interface MaintenanceStatusProvider {
//
// boolean maintenanceEnabled();
//
// }
// Path: src/com/namelessmc/plugin/spigot/ServerDataSender.java
import com.google.gson.JsonArray;
import com.google.gson.JsonObject;
import com.google.gson.JsonPrimitive;
import com.namelessmc.java_api.ApiError;
import com.namelessmc.java_api.NamelessException;
import com.namelessmc.plugin.spigot.hooks.maintenance.MaintenanceStatusProvider;
import net.md_5.bungee.api.ChatColor;
import org.bukkit.Bukkit;
import org.bukkit.Location;
import org.bukkit.Statistic;
import org.bukkit.configuration.file.FileConfiguration;
import org.bukkit.entity.Player;
import org.bukkit.scheduler.BukkitRunnable;
import java.net.SocketTimeoutException;
import java.util.Arrays;
package com.namelessmc.plugin.spigot;
public class ServerDataSender extends BukkitRunnable {
@Override
public void run() {
final FileConfiguration config = NamelessPlugin.getInstance().getConfig();
final int serverId = config.getInt("server-data-sender.server-id");
final JsonObject data = new JsonObject();
data.addProperty("tps", 20); // TODO Send real TPS
data.addProperty("time", System.currentTimeMillis());
data.addProperty("free-memory", Runtime.getRuntime().freeMemory());
data.addProperty("max-memory", Runtime.getRuntime().maxMemory());
data.addProperty("allocated-memory", Runtime.getRuntime().totalMemory());
data.addProperty("server-id", serverId);
final net.milkbowl.vault.permission.Permission permissions = NamelessPlugin.getInstance().getPermissions();
try {
if (permissions != null) {
final String[] gArray = permissions.getGroups();
final JsonArray groups = new JsonArray(gArray.length);
Arrays.stream(gArray).map(JsonPrimitive::new).forEach(groups::add);
data.add("groups", groups);
}
} catch (final UnsupportedOperationException ignored) {}
| MaintenanceStatusProvider maintenance = NamelessPlugin.getInstance().getMaintenanceStatusProvider(); |
ngageoint/disconnected-content-explorer-android | app/src/main/java/mil/nga/dice/map/geopackage/GeoPackageSelected.java | // Path: app/src/main/java/mil/nga/dice/DICEConstants.java
// public class DICEConstants {
//
// public static final String DICE_REPORT_DIRECTORY = "DICE";
// public static final String DICE_REPORT_NOTES_DIRECTORY = "notes";
// public static final String DICE_NO_MEDIA_FILE = ".nomedia";
// public static final String DICE_REPORT_SHARED_DIRECTORY = "shared";
// public static final String DICE_SELECTED_CACHES = "selectedCaches";
// public static final String DICE_ZOOM_TO_REPORTS = "zoomToReports";
// public static final String DICE_TEMP_CACHE_SUFFIX = "rp-";
// public static final int DICE_CACHE_FEATURE_TILES_MAX_POINTS_PER_TILE = 1000;
// public static final int DICE_CACHE_FEATURE_TILES_MAX_FEATURES_PER_TILE = 500;
// public static final int DICE_CACHE_FEATURES_MAX_POINTS_PER_TABLE = 1000;
// public static final int DICE_CACHE_FEATURES_MAX_FEATURES_PER_TABLE = 500;
// public static final int DICE_FEATURES_MAX_ZOOM = 21;
// public static final int DICE_FEATURE_TILES_MIN_ZOOM_OFFSET = 0;
//
// }
| import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import mil.nga.dice.DICEConstants; | package mil.nga.dice.map.geopackage;
/**
* Retrieve and update selected GeoPackages in the app settings
*/
public class GeoPackageSelected {
/**
* Shared preferences
*/
private final SharedPreferences settings;
/**
* Constructor
*
* @param context
*/
public GeoPackageSelected(Context context) {
settings = PreferenceManager
.getDefaultSharedPreferences(context);
}
/**
* Get the selected caches
*
* @return selected caches
*/
public Set<String> getSelectedSet() { | // Path: app/src/main/java/mil/nga/dice/DICEConstants.java
// public class DICEConstants {
//
// public static final String DICE_REPORT_DIRECTORY = "DICE";
// public static final String DICE_REPORT_NOTES_DIRECTORY = "notes";
// public static final String DICE_NO_MEDIA_FILE = ".nomedia";
// public static final String DICE_REPORT_SHARED_DIRECTORY = "shared";
// public static final String DICE_SELECTED_CACHES = "selectedCaches";
// public static final String DICE_ZOOM_TO_REPORTS = "zoomToReports";
// public static final String DICE_TEMP_CACHE_SUFFIX = "rp-";
// public static final int DICE_CACHE_FEATURE_TILES_MAX_POINTS_PER_TILE = 1000;
// public static final int DICE_CACHE_FEATURE_TILES_MAX_FEATURES_PER_TILE = 500;
// public static final int DICE_CACHE_FEATURES_MAX_POINTS_PER_TABLE = 1000;
// public static final int DICE_CACHE_FEATURES_MAX_FEATURES_PER_TABLE = 500;
// public static final int DICE_FEATURES_MAX_ZOOM = 21;
// public static final int DICE_FEATURE_TILES_MIN_ZOOM_OFFSET = 0;
//
// }
// Path: app/src/main/java/mil/nga/dice/map/geopackage/GeoPackageSelected.java
import android.content.Context;
import android.content.SharedPreferences;
import android.content.SharedPreferences.Editor;
import android.preference.PreferenceManager;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
import mil.nga.dice.DICEConstants;
package mil.nga.dice.map.geopackage;
/**
* Retrieve and update selected GeoPackages in the app settings
*/
public class GeoPackageSelected {
/**
* Shared preferences
*/
private final SharedPreferences settings;
/**
* Constructor
*
* @param context
*/
public GeoPackageSelected(Context context) {
settings = PreferenceManager
.getDefaultSharedPreferences(context);
}
/**
* Get the selected caches
*
* @return selected caches
*/
public Set<String> getSelectedSet() { | return settings.getStringSet(DICEConstants.DICE_SELECTED_CACHES, new HashSet<String>()); |
ngageoint/disconnected-content-explorer-android | app/src/main/java/mil/nga/dice/map/OfflineMap.java | // Path: app/src/main/java/mil/nga/dice/jackson/deserializer/FeatureDeserializer.java
// public class FeatureDeserializer extends Deserializer {
//
// private GeometryDeserializer geometryDeserializer = new GeometryDeserializer();
//
// public List<Geometry> parseFeatures(InputStream is) throws JsonParseException, IOException {
// List<Geometry> features = new ArrayList<Geometry>();
// JsonParser parser = factory.createParser(is);
// parser.nextToken();
//
// if (parser.getCurrentToken() != JsonToken.START_OBJECT) {
// return features;
// }
//
// while (parser.nextToken() != JsonToken.END_OBJECT) {
// String name = parser.getCurrentName();
// if ("features".equals(name)) {
// parser.nextToken();
// while (parser.nextToken() != JsonToken.END_ARRAY) {
// Geometry geometry = parseFeature(parser);
// features.add(geometry);
// }
// } else {
// parser.nextToken();
// parser.skipChildren();
// }
// }
//
// parser.close();
// return features;
// }
//
//
// private Geometry parseFeature(JsonParser parser) throws JsonParseException, IOException {
// Geometry geometry = null;
// if (parser.getCurrentToken() != JsonToken.START_OBJECT) {
// Collections.emptyList();
// }
//
// while (parser.nextToken() != JsonToken.END_OBJECT) {
// String name = parser.getCurrentName();
// if ("geometry".equals(name)) {
// parser.nextToken();
// geometry = geometryDeserializer.parseGeometry(parser);
// } else {
// parser.nextToken();
// parser.skipChildren();
// }
// }
//
// return geometry;
// }
// }
| import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.util.TimeUtils;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.TileOverlay;
import com.google.android.gms.maps.model.TileOverlayOptions;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.MultiPolygon;
import mil.nga.dice.jackson.deserializer.FeatureDeserializer; | }
polygons.clear();
}
private void polygonsReady() {
Log.d(TAG, "adding " + polygonOptions.size() + " polygons to map");
polygons = new ArrayList<Polygon>(polygonOptions.size());
for (PolygonOptions polygon : polygonOptions) {
polygon.visible(isVisible());
polygons.add(map.addPolygon(polygon));
}
Log.d(TAG, "polygons added to map");
}
private static class LoadOfflineMapTask extends AsyncTask<Void, Void, List<Geometry>> {
private static final String OFFLINE_MAP_FILENAME = "ne_110m_land.geojson";
private final Context context;
public LoadOfflineMapTask(Context context) {
this.context = context;
}
@Override
protected List<Geometry> doInBackground(Void... params) {
// TODO: parse geojson directly into PolygonOptions
List<Geometry> geometries = new ArrayList<>();
InputStream is = null;
try {
is = context.getAssets().open(OFFLINE_MAP_FILENAME); | // Path: app/src/main/java/mil/nga/dice/jackson/deserializer/FeatureDeserializer.java
// public class FeatureDeserializer extends Deserializer {
//
// private GeometryDeserializer geometryDeserializer = new GeometryDeserializer();
//
// public List<Geometry> parseFeatures(InputStream is) throws JsonParseException, IOException {
// List<Geometry> features = new ArrayList<Geometry>();
// JsonParser parser = factory.createParser(is);
// parser.nextToken();
//
// if (parser.getCurrentToken() != JsonToken.START_OBJECT) {
// return features;
// }
//
// while (parser.nextToken() != JsonToken.END_OBJECT) {
// String name = parser.getCurrentName();
// if ("features".equals(name)) {
// parser.nextToken();
// while (parser.nextToken() != JsonToken.END_ARRAY) {
// Geometry geometry = parseFeature(parser);
// features.add(geometry);
// }
// } else {
// parser.nextToken();
// parser.skipChildren();
// }
// }
//
// parser.close();
// return features;
// }
//
//
// private Geometry parseFeature(JsonParser parser) throws JsonParseException, IOException {
// Geometry geometry = null;
// if (parser.getCurrentToken() != JsonToken.START_OBJECT) {
// Collections.emptyList();
// }
//
// while (parser.nextToken() != JsonToken.END_OBJECT) {
// String name = parser.getCurrentName();
// if ("geometry".equals(name)) {
// parser.nextToken();
// geometry = geometryDeserializer.parseGeometry(parser);
// } else {
// parser.nextToken();
// parser.skipChildren();
// }
// }
//
// return geometry;
// }
// }
// Path: app/src/main/java/mil/nga/dice/map/OfflineMap.java
import java.io.IOException;
import java.io.InputStream;
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
import java.util.List;
import java.util.concurrent.TimeUnit;
import android.content.Context;
import android.os.AsyncTask;
import android.util.Log;
import android.util.TimeUtils;
import com.google.android.gms.maps.GoogleMap;
import com.google.android.gms.maps.model.LatLng;
import com.google.android.gms.maps.model.Polygon;
import com.google.android.gms.maps.model.PolygonOptions;
import com.google.android.gms.maps.model.TileOverlay;
import com.google.android.gms.maps.model.TileOverlayOptions;
import com.vividsolutions.jts.geom.Coordinate;
import com.vividsolutions.jts.geom.Geometry;
import com.vividsolutions.jts.geom.MultiPolygon;
import mil.nga.dice.jackson.deserializer.FeatureDeserializer;
}
polygons.clear();
}
private void polygonsReady() {
Log.d(TAG, "adding " + polygonOptions.size() + " polygons to map");
polygons = new ArrayList<Polygon>(polygonOptions.size());
for (PolygonOptions polygon : polygonOptions) {
polygon.visible(isVisible());
polygons.add(map.addPolygon(polygon));
}
Log.d(TAG, "polygons added to map");
}
private static class LoadOfflineMapTask extends AsyncTask<Void, Void, List<Geometry>> {
private static final String OFFLINE_MAP_FILENAME = "ne_110m_land.geojson";
private final Context context;
public LoadOfflineMapTask(Context context) {
this.context = context;
}
@Override
protected List<Geometry> doInBackground(Void... params) {
// TODO: parse geojson directly into PolygonOptions
List<Geometry> geometries = new ArrayList<>();
InputStream is = null;
try {
is = context.getAssets().open(OFFLINE_MAP_FILENAME); | geometries = new FeatureDeserializer().parseFeatures(is); |
ngageoint/disconnected-content-explorer-android | app/src/main/java/mil/nga/dice/report/ReportUtils.java | // Path: app/src/main/java/mil/nga/dice/DICEConstants.java
// public class DICEConstants {
//
// public static final String DICE_REPORT_DIRECTORY = "DICE";
// public static final String DICE_REPORT_NOTES_DIRECTORY = "notes";
// public static final String DICE_NO_MEDIA_FILE = ".nomedia";
// public static final String DICE_REPORT_SHARED_DIRECTORY = "shared";
// public static final String DICE_SELECTED_CACHES = "selectedCaches";
// public static final String DICE_ZOOM_TO_REPORTS = "zoomToReports";
// public static final String DICE_TEMP_CACHE_SUFFIX = "rp-";
// public static final int DICE_CACHE_FEATURE_TILES_MAX_POINTS_PER_TILE = 1000;
// public static final int DICE_CACHE_FEATURE_TILES_MAX_FEATURES_PER_TILE = 500;
// public static final int DICE_CACHE_FEATURES_MAX_POINTS_PER_TABLE = 1000;
// public static final int DICE_CACHE_FEATURES_MAX_FEATURES_PER_TABLE = 500;
// public static final int DICE_FEATURES_MAX_ZOOM = 21;
// public static final int DICE_FEATURE_TILES_MIN_ZOOM_OFFSET = 0;
//
// }
| import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import mil.nga.dice.DICEConstants; | package mil.nga.dice.report;
/**
* Report utilities
*/
public class ReportUtils {
public static final String DELETE_FILE_PREFIX = ".deleting.";
private static final Set<String> supportedReportFileTypes;
static {
Set<String> types = new TreeSet<>(Arrays.asList(new String[]{
"zip", "application/zip",
"pdf", "application/pdf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
}));
supportedReportFileTypes = Collections.unmodifiableSet(types);
}
/**
* Get the base report directory
*
* @return report directories
*/
public static File getReportDirectory() { | // Path: app/src/main/java/mil/nga/dice/DICEConstants.java
// public class DICEConstants {
//
// public static final String DICE_REPORT_DIRECTORY = "DICE";
// public static final String DICE_REPORT_NOTES_DIRECTORY = "notes";
// public static final String DICE_NO_MEDIA_FILE = ".nomedia";
// public static final String DICE_REPORT_SHARED_DIRECTORY = "shared";
// public static final String DICE_SELECTED_CACHES = "selectedCaches";
// public static final String DICE_ZOOM_TO_REPORTS = "zoomToReports";
// public static final String DICE_TEMP_CACHE_SUFFIX = "rp-";
// public static final int DICE_CACHE_FEATURE_TILES_MAX_POINTS_PER_TILE = 1000;
// public static final int DICE_CACHE_FEATURE_TILES_MAX_FEATURES_PER_TILE = 500;
// public static final int DICE_CACHE_FEATURES_MAX_POINTS_PER_TABLE = 1000;
// public static final int DICE_CACHE_FEATURES_MAX_FEATURES_PER_TABLE = 500;
// public static final int DICE_FEATURES_MAX_ZOOM = 21;
// public static final int DICE_FEATURE_TILES_MIN_ZOOM_OFFSET = 0;
//
// }
// Path: app/src/main/java/mil/nga/dice/report/ReportUtils.java
import android.content.Context;
import android.net.Uri;
import android.os.Environment;
import java.io.File;
import java.io.FileFilter;
import java.util.Arrays;
import java.util.Collections;
import java.util.Set;
import java.util.TreeSet;
import mil.nga.dice.DICEConstants;
package mil.nga.dice.report;
/**
* Report utilities
*/
public class ReportUtils {
public static final String DELETE_FILE_PREFIX = ".deleting.";
private static final Set<String> supportedReportFileTypes;
static {
Set<String> types = new TreeSet<>(Arrays.asList(new String[]{
"zip", "application/zip",
"pdf", "application/pdf",
"doc",
"docx",
"xls",
"xlsx",
"ppt",
"pptx"
}));
supportedReportFileTypes = Collections.unmodifiableSet(types);
}
/**
* Get the base report directory
*
* @return report directories
*/
public static File getReportDirectory() { | return new File(Environment.getExternalStorageDirectory(), DICEConstants.DICE_REPORT_DIRECTORY); |
googlecodelabs/android-tv-leanback | checkpoint_5/src/main/java/com/android/example/leanback/VideoDetailsFragment.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsFragment extends Fragment {
private View mView; | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_5/src/main/java/com/android/example/leanback/VideoDetailsFragment.java
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsFragment extends Fragment {
private View mView; | private Video mVideo; |
googlecodelabs/android-tv-leanback | checkpoint_6/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video; | public ImageCardView getCardView() {
return mCardView;
}
protected void updateCardViewImage(String url) {
Picasso.with(mContext)
.load(url)
.resize(CARD_WIDTH, CARD_HEIGHT)
.centerCrop()
.error(mDefaultCardImage)
.into(mImageCardViewTarget);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_6/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video;
public ImageCardView getCardView() {
return mCardView;
}
protected void updateCardViewImage(String url) {
Picasso.with(mContext)
.load(url)
.resize(CARD_WIDTH, CARD_HEIGHT)
.centerCrop()
.error(mDefaultCardImage)
.into(mImageCardViewTarget);
}
}
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | Video video = (Video) o; |
googlecodelabs/android-tv-leanback | checkpoint_4/src/main/java/com/android/example/leanback/VideoDetailsActivity.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Activity;
import android.os.Bundle;
import com.android.example.leanback.data.Video; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* Created by anirudhd on 11/5/14.
*/
public class VideoDetailsActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
| // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_4/src/main/java/com/android/example/leanback/VideoDetailsActivity.java
import android.app.Activity;
import android.os.Bundle;
import com.android.example.leanback.data.Video;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* Created by anirudhd on 11/5/14.
*/
public class VideoDetailsActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
| Video video = (Video) getIntent().getExtras().get(Video.INTENT_EXTRA_VIDEO); |
googlecodelabs/android-tv-leanback | checkpoint_5/src/main/java/com/android/example/leanback/VideoDetailsActivity.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Activity;
import android.os.Bundle;
import com.android.example.leanback.data.Video; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
| // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_5/src/main/java/com/android/example/leanback/VideoDetailsActivity.java
import android.app.Activity;
import android.os.Bundle;
import com.android.example.leanback.data.Video;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsActivity extends Activity {
/**
* Called when the activity is first created.
*/
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
setContentView(R.layout.activity_details);
| Video video = (Video) getIntent().getExtras().get(Video.INTENT_EXTRA_VIDEO); |
googlecodelabs/android-tv-leanback | checkpoint_6/src/main/java/com/android/example/leanback/fastlane/DetailsDescriptionPresenter.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.content.Context;
import android.support.v17.leanback.widget.AbstractDetailsDescriptionPresenter;
import android.util.Log;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
public class DetailsDescriptionPresenter extends AbstractDetailsDescriptionPresenter {
private final Context mContext;
private DetailsDescriptionPresenter() {
super();
this.mContext = null;
}
public DetailsDescriptionPresenter(Context ctx) {
super();
this.mContext = ctx;
}
@Override
protected void onBindDescription(ViewHolder viewHolder, Object item) { | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_6/src/main/java/com/android/example/leanback/fastlane/DetailsDescriptionPresenter.java
import android.content.Context;
import android.support.v17.leanback.widget.AbstractDetailsDescriptionPresenter;
import android.util.Log;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
public class DetailsDescriptionPresenter extends AbstractDetailsDescriptionPresenter {
private final Context mContext;
private DetailsDescriptionPresenter() {
super();
this.mContext = null;
}
public DetailsDescriptionPresenter(Context ctx) {
super();
this.mContext = ctx;
}
@Override
protected void onBindDescription(ViewHolder viewHolder, Object item) { | Video video = (Video) item; |
googlecodelabs/android-tv-leanback | checkpoint_0/src/main/java/com/android/example/leanback/PlayerActivity.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Activity;
import android.media.MediaCodec;
import android.media.MediaCodec.CryptoException;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import com.android.example.leanback.data.Video;
import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.FrameworkSampleSource;
import com.google.android.exoplayer.MediaCodecAudioTrackRenderer;
import com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException;
import com.google.android.exoplayer.MediaCodecVideoTrackRenderer;
import com.google.android.exoplayer.SampleSource;
import com.google.android.exoplayer.TrackRenderer;
import com.google.android.exoplayer.VideoSurfaceView;
import com.google.android.exoplayer.util.PlayerControl; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* An activity that plays media using {@link ExoPlayer}.
*/
public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
ExoPlayer.Listener, MediaCodecVideoTrackRenderer.EventListener {
public static final int RENDERER_COUNT = 2;
private static final String TAG = "PlayerActivity";
| // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_0/src/main/java/com/android/example/leanback/PlayerActivity.java
import android.app.Activity;
import android.media.MediaCodec;
import android.media.MediaCodec.CryptoException;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import com.android.example.leanback.data.Video;
import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.FrameworkSampleSource;
import com.google.android.exoplayer.MediaCodecAudioTrackRenderer;
import com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException;
import com.google.android.exoplayer.MediaCodecVideoTrackRenderer;
import com.google.android.exoplayer.SampleSource;
import com.google.android.exoplayer.TrackRenderer;
import com.google.android.exoplayer.VideoSurfaceView;
import com.google.android.exoplayer.util.PlayerControl;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* An activity that plays media using {@link ExoPlayer}.
*/
public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
ExoPlayer.Listener, MediaCodecVideoTrackRenderer.EventListener {
public static final int RENDERER_COUNT = 2;
private static final String TAG = "PlayerActivity";
| private Video mVideo; |
googlecodelabs/android-tv-leanback | checkpoint_4/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
/**
* Created by anirudhd on 11/2/14.
*/
public class CardPresenter extends Presenter {
private static int CARD_WIDTH = 200;
private static int CARD_HEIGHT = 200;
private static Context mContext;
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_4/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
/**
* Created by anirudhd on 11/2/14.
*/
public class CardPresenter extends Presenter {
private static int CARD_WIDTH = 200;
private static int CARD_HEIGHT = 200;
private static Context mContext;
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | Video video = (Video) o; |
googlecodelabs/android-tv-leanback | checkpoint_5/src/main/java/com/android/example/leanback/PlayerActivity.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Activity;
import android.media.MediaCodec;
import android.media.MediaCodec.CryptoException;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import com.android.example.leanback.data.Video;
import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.FrameworkSampleSource;
import com.google.android.exoplayer.MediaCodecAudioTrackRenderer;
import com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException;
import com.google.android.exoplayer.MediaCodecVideoTrackRenderer;
import com.google.android.exoplayer.SampleSource;
import com.google.android.exoplayer.TrackRenderer;
import com.google.android.exoplayer.VideoSurfaceView;
import com.google.android.exoplayer.util.PlayerControl; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* An activity that plays media using {@link com.google.android.exoplayer.ExoPlayer}.
*/
public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
ExoPlayer.Listener, MediaCodecVideoTrackRenderer.EventListener {
public static final int RENDERER_COUNT = 2;
private static final String TAG = "PlayerActivity";
| // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_5/src/main/java/com/android/example/leanback/PlayerActivity.java
import android.app.Activity;
import android.media.MediaCodec;
import android.media.MediaCodec.CryptoException;
import android.net.Uri;
import android.os.Bundle;
import android.util.Log;
import android.view.Surface;
import android.view.SurfaceHolder;
import android.view.View;
import android.widget.MediaController;
import android.widget.Toast;
import com.android.example.leanback.data.Video;
import com.google.android.exoplayer.ExoPlaybackException;
import com.google.android.exoplayer.ExoPlayer;
import com.google.android.exoplayer.FrameworkSampleSource;
import com.google.android.exoplayer.MediaCodecAudioTrackRenderer;
import com.google.android.exoplayer.MediaCodecTrackRenderer.DecoderInitializationException;
import com.google.android.exoplayer.MediaCodecVideoTrackRenderer;
import com.google.android.exoplayer.SampleSource;
import com.google.android.exoplayer.TrackRenderer;
import com.google.android.exoplayer.VideoSurfaceView;
import com.google.android.exoplayer.util.PlayerControl;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* An activity that plays media using {@link com.google.android.exoplayer.ExoPlayer}.
*/
public class PlayerActivity extends Activity implements SurfaceHolder.Callback,
ExoPlayer.Listener, MediaCodecVideoTrackRenderer.EventListener {
public static final int RENDERER_COUNT = 2;
private static final String TAG = "PlayerActivity";
| private Video mVideo; |
googlecodelabs/android-tv-leanback | checkpoint_5/src/main/java/com/android/example/leanback/fastlane/BackgroundHelper.java | // Path: checkpoint_5/src/main/java/com/android/example/leanback/BlurTransform.java
// public class BlurTransform implements Transformation {
//
// static BlurTransform blurTransform;
// RenderScript rs;
//
// protected BlurTransform() {
// // Exists only to defeat instantiation.
// }
//
// private BlurTransform(Context context) {
// super();
// rs = RenderScript.create(context);
// }
//
// public static BlurTransform getInstance(Context context) {
// if (blurTransform == null) {
// blurTransform = new BlurTransform(context);
// }
// return blurTransform;
// }
//
// @Override
// public Bitmap transform(Bitmap bitmap) {
// // Create another bitmap that will hold the results of the filter.
// Bitmap blurredBitmap = Bitmap.createBitmap(bitmap);
//
// // Allocate memory for Renderscript to work with
// Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_FULL, Allocation.USAGE_SHARED);
// Allocation output = Allocation.createTyped(rs, input.getType());
//
// // Load up an instance of the specific script that we want to use.
// ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// script.setInput(input);
//
// // Set the blur radius
// script.setRadius(20);
//
// // Start the ScriptIntrinisicBlur
// script.forEach(output);
//
// // Copy the output to the blurred bitmap
// output.copyTo(blurredBitmap);
//
// bitmap.recycle();
//
// return blurredBitmap;
// }
//
// @Override
// public String key() {
// return "blur";
// }
//
// }
| import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v17.leanback.app.BackgroundManager;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics;
import com.android.example.leanback.BlurTransform;
import com.android.example.leanback.R;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target; | mBackgroundManager.attach(mActivity.getWindow());
mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
mDefaultBackground = ContextCompat.getDrawable(mActivity, R.drawable.default_background);
mMetrics = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
public void release() {
mHandler.removeCallbacksAndMessages(null);
mBackgroundManager.release();
}
public void setBackgroundUrl(String backgroundUrl) {
this.mBackgroundURL = backgroundUrl;
scheduleUpdate();
}
protected void setDefaultBackground(Drawable background) {
mDefaultBackground = background;
}
protected void setDefaultBackground(int resourceId) {
mDefaultBackground = ContextCompat.getDrawable(mActivity, resourceId);
}
protected void updateBackground(String url) {
Picasso.with(mActivity)
.load(url)
.resize(mMetrics.widthPixels, mMetrics.heightPixels)
.centerCrop() | // Path: checkpoint_5/src/main/java/com/android/example/leanback/BlurTransform.java
// public class BlurTransform implements Transformation {
//
// static BlurTransform blurTransform;
// RenderScript rs;
//
// protected BlurTransform() {
// // Exists only to defeat instantiation.
// }
//
// private BlurTransform(Context context) {
// super();
// rs = RenderScript.create(context);
// }
//
// public static BlurTransform getInstance(Context context) {
// if (blurTransform == null) {
// blurTransform = new BlurTransform(context);
// }
// return blurTransform;
// }
//
// @Override
// public Bitmap transform(Bitmap bitmap) {
// // Create another bitmap that will hold the results of the filter.
// Bitmap blurredBitmap = Bitmap.createBitmap(bitmap);
//
// // Allocate memory for Renderscript to work with
// Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_FULL, Allocation.USAGE_SHARED);
// Allocation output = Allocation.createTyped(rs, input.getType());
//
// // Load up an instance of the specific script that we want to use.
// ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// script.setInput(input);
//
// // Set the blur radius
// script.setRadius(20);
//
// // Start the ScriptIntrinisicBlur
// script.forEach(output);
//
// // Copy the output to the blurred bitmap
// output.copyTo(blurredBitmap);
//
// bitmap.recycle();
//
// return blurredBitmap;
// }
//
// @Override
// public String key() {
// return "blur";
// }
//
// }
// Path: checkpoint_5/src/main/java/com/android/example/leanback/fastlane/BackgroundHelper.java
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v17.leanback.app.BackgroundManager;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics;
import com.android.example.leanback.BlurTransform;
import com.android.example.leanback.R;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
mBackgroundManager.attach(mActivity.getWindow());
mBackgroundTarget = new PicassoBackgroundManagerTarget(mBackgroundManager);
mDefaultBackground = ContextCompat.getDrawable(mActivity, R.drawable.default_background);
mMetrics = new DisplayMetrics();
mActivity.getWindowManager().getDefaultDisplay().getMetrics(mMetrics);
}
public void release() {
mHandler.removeCallbacksAndMessages(null);
mBackgroundManager.release();
}
public void setBackgroundUrl(String backgroundUrl) {
this.mBackgroundURL = backgroundUrl;
scheduleUpdate();
}
protected void setDefaultBackground(Drawable background) {
mDefaultBackground = background;
}
protected void setDefaultBackground(int resourceId) {
mDefaultBackground = ContextCompat.getDrawable(mActivity, resourceId);
}
protected void updateBackground(String url) {
Picasso.with(mActivity)
.load(url)
.resize(mMetrics.widthPixels, mMetrics.heightPixels)
.centerCrop() | .transform(BlurTransform.getInstance(mActivity)) |
googlecodelabs/android-tv-leanback | checkpoint_6/src/main/java/com/android/example/leanback/VideoDetailsFragment.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsFragment extends Fragment {
private View mView;
/**
* Create a new instance of MyDialogFragment, providing "num"
* as an argument.
*/
static VideoDetailsFragment newInstance(String tag) {
VideoDetailsFragment f = new VideoDetailsFragment();
// Supply num input as an argument.
Bundle args = new Bundle();
args.putString("TAG", tag);
f.setArguments(args);
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.fragment_details, container, false);
return mView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Picasso.with(getActivity()).load(mVideo.getThumbUrl()).transform(BlurTransform.getInstance(this.getActivity())).fit().into((ImageView) mView.findViewById(R.id.image_view));
((TextView) mView.findViewById(R.id.movie_info_title)).setText(mVideo.getTitle());
((TextView) mView.findViewById(R.id.movie_info_text)).setText(mVideo.getDescription());
mView.findViewById(R.id.movie_play).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), PlayerActivity.class); | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_6/src/main/java/com/android/example/leanback/VideoDetailsFragment.java
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
public class VideoDetailsFragment extends Fragment {
private View mView;
/**
* Create a new instance of MyDialogFragment, providing "num"
* as an argument.
*/
static VideoDetailsFragment newInstance(String tag) {
VideoDetailsFragment f = new VideoDetailsFragment();
// Supply num input as an argument.
Bundle args = new Bundle();
args.putString("TAG", tag);
f.setArguments(args);
return f;
}
@Override
public void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);
}
@Override
public View onCreateView(LayoutInflater inflater, ViewGroup container,
Bundle savedInstanceState) {
mView = inflater.inflate(R.layout.fragment_details, container, false);
return mView;
}
@Override
public void onActivityCreated(Bundle savedInstanceState) {
super.onActivityCreated(savedInstanceState);
Picasso.with(getActivity()).load(mVideo.getThumbUrl()).transform(BlurTransform.getInstance(this.getActivity())).fit().into((ImageView) mView.findViewById(R.id.image_view));
((TextView) mView.findViewById(R.id.movie_info_title)).setText(mVideo.getTitle());
((TextView) mView.findViewById(R.id.movie_info_text)).setText(mVideo.getDescription());
mView.findViewById(R.id.movie_play).setOnClickListener(new View.OnClickListener() {
@Override
public void onClick(View view) {
Intent intent = new Intent(getActivity(), PlayerActivity.class); | intent.putExtra(Video.INTENT_EXTRA_VIDEO, mVideo); |
googlecodelabs/android-tv-leanback | checkpoint_6/src/main/java/com/android/example/leanback/fastlane/BackgroundHelper.java | // Path: checkpoint_5/src/main/java/com/android/example/leanback/BlurTransform.java
// public class BlurTransform implements Transformation {
//
// static BlurTransform blurTransform;
// RenderScript rs;
//
// protected BlurTransform() {
// // Exists only to defeat instantiation.
// }
//
// private BlurTransform(Context context) {
// super();
// rs = RenderScript.create(context);
// }
//
// public static BlurTransform getInstance(Context context) {
// if (blurTransform == null) {
// blurTransform = new BlurTransform(context);
// }
// return blurTransform;
// }
//
// @Override
// public Bitmap transform(Bitmap bitmap) {
// // Create another bitmap that will hold the results of the filter.
// Bitmap blurredBitmap = Bitmap.createBitmap(bitmap);
//
// // Allocate memory for Renderscript to work with
// Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_FULL, Allocation.USAGE_SHARED);
// Allocation output = Allocation.createTyped(rs, input.getType());
//
// // Load up an instance of the specific script that we want to use.
// ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// script.setInput(input);
//
// // Set the blur radius
// script.setRadius(20);
//
// // Start the ScriptIntrinisicBlur
// script.forEach(output);
//
// // Copy the output to the blurred bitmap
// output.copyTo(blurredBitmap);
//
// bitmap.recycle();
//
// return blurredBitmap;
// }
//
// @Override
// public String key() {
// return "blur";
// }
//
// }
| import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v17.leanback.app.BackgroundManager;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics;
import com.android.example.leanback.BlurTransform;
import com.android.example.leanback.R;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target; |
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
PicassoBackgroundManagerTarget that = (PicassoBackgroundManagerTarget) o;
return mBackgroundManager.equals(that.mBackgroundManager);
}
@Override
public int hashCode() {
return mBackgroundManager.hashCode();
}
}
protected void setDefaultBackground(Drawable background) {
mDefaultBackground = background;
}
protected void setDefaultBackground(int resourceId) {
mDefaultBackground = ContextCompat.getDrawable(mActivity, resourceId);
}
protected void updateBackground(String url) {
Picasso.with(mActivity)
.load(url)
.resize(mMetrics.widthPixels, mMetrics.heightPixels)
.centerCrop() | // Path: checkpoint_5/src/main/java/com/android/example/leanback/BlurTransform.java
// public class BlurTransform implements Transformation {
//
// static BlurTransform blurTransform;
// RenderScript rs;
//
// protected BlurTransform() {
// // Exists only to defeat instantiation.
// }
//
// private BlurTransform(Context context) {
// super();
// rs = RenderScript.create(context);
// }
//
// public static BlurTransform getInstance(Context context) {
// if (blurTransform == null) {
// blurTransform = new BlurTransform(context);
// }
// return blurTransform;
// }
//
// @Override
// public Bitmap transform(Bitmap bitmap) {
// // Create another bitmap that will hold the results of the filter.
// Bitmap blurredBitmap = Bitmap.createBitmap(bitmap);
//
// // Allocate memory for Renderscript to work with
// Allocation input = Allocation.createFromBitmap(rs, bitmap, Allocation.MipmapControl.MIPMAP_FULL, Allocation.USAGE_SHARED);
// Allocation output = Allocation.createTyped(rs, input.getType());
//
// // Load up an instance of the specific script that we want to use.
// ScriptIntrinsicBlur script = ScriptIntrinsicBlur.create(rs, Element.U8_4(rs));
// script.setInput(input);
//
// // Set the blur radius
// script.setRadius(20);
//
// // Start the ScriptIntrinisicBlur
// script.forEach(output);
//
// // Copy the output to the blurred bitmap
// output.copyTo(blurredBitmap);
//
// bitmap.recycle();
//
// return blurredBitmap;
// }
//
// @Override
// public String key() {
// return "blur";
// }
//
// }
// Path: checkpoint_6/src/main/java/com/android/example/leanback/fastlane/BackgroundHelper.java
import android.app.Activity;
import android.graphics.Bitmap;
import android.graphics.drawable.Drawable;
import android.os.Handler;
import android.support.v17.leanback.app.BackgroundManager;
import android.support.v4.content.ContextCompat;
import android.util.DisplayMetrics;
import com.android.example.leanback.BlurTransform;
import com.android.example.leanback.R;
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
@Override
public boolean equals(Object o) {
if (this == o) { return true; }
if (o == null || getClass() != o.getClass()) { return false; }
PicassoBackgroundManagerTarget that = (PicassoBackgroundManagerTarget) o;
return mBackgroundManager.equals(that.mBackgroundManager);
}
@Override
public int hashCode() {
return mBackgroundManager.hashCode();
}
}
protected void setDefaultBackground(Drawable background) {
mDefaultBackground = background;
}
protected void setDefaultBackground(int resourceId) {
mDefaultBackground = ContextCompat.getDrawable(mActivity, resourceId);
}
protected void updateBackground(String url) {
Picasso.with(mActivity)
.load(url)
.resize(mMetrics.widthPixels, mMetrics.heightPixels)
.centerCrop() | .transform(BlurTransform.getInstance(mActivity)) |
googlecodelabs/android-tv-leanback | checkpoint_4/src/main/java/com/android/example/leanback/VideoDetailsFragment.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* Created by anirudhd on 11/5/14.
*/
public class VideoDetailsFragment extends Fragment {
private View mView; | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_4/src/main/java/com/android/example/leanback/VideoDetailsFragment.java
import android.app.Fragment;
import android.content.Intent;
import android.os.Bundle;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.ImageView;
import android.widget.TextView;
import com.android.example.leanback.data.Video;
import com.squareup.picasso.Picasso;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback;
/**
* Created by anirudhd on 11/5/14.
*/
public class VideoDetailsFragment extends Fragment {
private View mView; | private Video mVideo; |
googlecodelabs/android-tv-leanback | checkpoint_5/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
| import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video; | /*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
public class CardPresenter extends Presenter {
private static int CARD_WIDTH = 200;
private static int CARD_HEIGHT = 200;
private static Context mContext;
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | // Path: checkpoint_6/src/main/java/com/android/example/leanback/data/Video.java
// public class Video implements Serializable {
//
// public static final String INTENT_EXTRA_VIDEO = "INTENT_EXTRA_VIDEO";
// private long id;
// private int year;
// private int rating;
// private String description;
// private String title;
// private String thumbUrl;
// private String contentUrl;
// private String category;
// private String tags;
//
// public int getYear() {
// return year;
// }
//
// public void setYear(int year) {
// this.year = year;
// }
//
// public int getRating() {
// return rating;
// }
//
// public void setRating(int rating) {
// this.rating = rating;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public String getTitle() {
// return title;
// }
//
// public void setTitle(String title) {
// this.title = title;
// }
//
// public String getThumbUrl() {
// return thumbUrl;
// }
//
// public void setThumbUrl(String thumbUrl) {
// this.thumbUrl = thumbUrl;
// }
//
// public String getContentUrl() {
// return contentUrl;
// }
//
// public void setContentUrl(String contentUrl) {
// this.contentUrl = contentUrl;
// }
//
// public String getCategory() {
// return category;
// }
//
// public void setCategory(String category) {
// this.category = category;
// }
//
// public String getTags() {
// return tags;
// }
//
// public void setTags(String tags) {
// this.tags = tags;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public long getId() {
// return id;
// }
// }
// Path: checkpoint_5/src/main/java/com/android/example/leanback/fastlane/CardPresenter.java
import com.squareup.picasso.Picasso;
import com.squareup.picasso.Target;
import android.content.Context;
import android.graphics.Bitmap;
import android.graphics.Color;
import android.graphics.drawable.BitmapDrawable;
import android.graphics.drawable.Drawable;
import android.support.v17.leanback.widget.ImageCardView;
import android.support.v17.leanback.widget.Presenter;
import android.util.Log;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import com.android.example.leanback.R;
import com.android.example.leanback.data.Video;
/*
* Copyright 2014 Google Inc. All rights reserved.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.android.example.leanback.fastlane;
public class CardPresenter extends Presenter {
private static int CARD_WIDTH = 200;
private static int CARD_HEIGHT = 200;
private static Context mContext;
@Override
public ViewHolder onCreateViewHolder(ViewGroup viewGroup) {
Log.d("onCreateViewHolder", "creating viewholder");
mContext = viewGroup.getContext();
ImageCardView cardView = new ImageCardView(mContext);
cardView.setFocusable(true);
cardView.setFocusableInTouchMode(true);
((TextView) cardView.findViewById(R.id.content_text)).setTextColor(Color.LTGRAY);
return new ViewHolder(cardView);
}
@Override
public void onBindViewHolder(Presenter.ViewHolder viewHolder, Object o) { | Video video = (Video) o; |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/pages/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.pages;
public class DeleteExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/pages/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.pages;
public class DeleteExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| Page page = CreateExample.create(pageClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.streams;
public class DeleteExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.streams;
public class DeleteExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| Stream sds = CreateExample.createStream(sdsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.accounts;
public class RetrieveExample extends ExampleBase {
@Test
public void retrieve_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.accounts;
public class RetrieveExample extends ExampleBase {
@Test
public void retrieve_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| Account account = CreateExample.createAccount(accountClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.accounts;
public class RetrieveExample extends ExampleBase {
@Test
public void retrieve_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
Account account = CreateExample.createAccount(accountClient);
Account retrieved = accountClient.get(account.getId());
System.out.println("Retrieved account: " + retrieved);
}
@Test
public void retrieve_account_type_example() throws IOException {
AccountClient accountClient = client.accountClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.accounts;
public class RetrieveExample extends ExampleBase {
@Test
public void retrieve_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
Account account = CreateExample.createAccount(accountClient);
Account retrieved = accountClient.get(account.getId());
System.out.println("Retrieved account: " + retrieved);
}
@Test
public void retrieve_account_type_example() throws IOException {
AccountClient accountClient = client.accountClient();
| AccountType accountType = accountClient.getAccountType("facebook"); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/CreateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test; | package com.domo.sdk.groups;
public class CreateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
CreateExample.createGroup(gClient);
}
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/CreateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test;
package com.domo.sdk.groups;
public class CreateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
CreateExample.createGroup(gClient);
}
| public static Group createGroup(GroupClient gClient) { |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.datasets;
public class RetrieveExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.datasets;
public class RetrieveExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | DataSet ds = CreateExample.create(dsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.streams;
public class RetrieveExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.streams;
public class RetrieveExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| Stream sds = CreateExample.createStream(sdsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test; | package com.domo.sdk.groups;
public class DeleteExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test;
package com.domo.sdk.groups;
public class DeleteExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | Group group = CreateExample.createGroup(gClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSetListResult.java
// public class DataSetListResult {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Owner owner;
// private String dataCurrentAt;
// private String createdAt;
// private String updatedAt;
// private boolean pdpEnabled;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getDataCurrentAt() {
// return dataCurrentAt;
// }
//
// public void setDataCurrentAt(String dataCurrentAt) {
// this.dataCurrentAt = dataCurrentAt;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public boolean isPdpEnabled() {
// return pdpEnabled;
// }
//
// public void setPdpEnabled(boolean pdpEnabled) {
// this.pdpEnabled = pdpEnabled;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSetListResult that = (DataSetListResult) o;
// return rows == that.rows &&
// columns == that.columns &&
// pdpEnabled == that.pdpEnabled &&
// Objects.equals(id, that.id) &&
// Objects.equals(name, that.name) &&
// Objects.equals(description, that.description) &&
// Objects.equals(owner, that.owner) &&
// Objects.equals(dataCurrentAt, that.dataCurrentAt) &&
// Objects.equals(createdAt, that.createdAt) &&
// Objects.equals(updatedAt, that.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, owner, dataCurrentAt, createdAt, updatedAt, pdpEnabled);
// }
//
// @Override
// public String toString() {
// return "DataSetListResult{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", owner=" + owner +
// ", dataCurrentAt='" + dataCurrentAt + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", pdpEnabled=" + pdpEnabled +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSetListResult;
import org.junit.Test;
import java.io.IOException;
import java.util.List; | package com.domo.sdk.datasets;
public class ListExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//List DS
String sortBy = "name";
int limit = 5;
int offset = 0; | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSetListResult.java
// public class DataSetListResult {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Owner owner;
// private String dataCurrentAt;
// private String createdAt;
// private String updatedAt;
// private boolean pdpEnabled;
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getDataCurrentAt() {
// return dataCurrentAt;
// }
//
// public void setDataCurrentAt(String dataCurrentAt) {
// this.dataCurrentAt = dataCurrentAt;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public boolean isPdpEnabled() {
// return pdpEnabled;
// }
//
// public void setPdpEnabled(boolean pdpEnabled) {
// this.pdpEnabled = pdpEnabled;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSetListResult that = (DataSetListResult) o;
// return rows == that.rows &&
// columns == that.columns &&
// pdpEnabled == that.pdpEnabled &&
// Objects.equals(id, that.id) &&
// Objects.equals(name, that.name) &&
// Objects.equals(description, that.description) &&
// Objects.equals(owner, that.owner) &&
// Objects.equals(dataCurrentAt, that.dataCurrentAt) &&
// Objects.equals(createdAt, that.createdAt) &&
// Objects.equals(updatedAt, that.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, owner, dataCurrentAt, createdAt, updatedAt, pdpEnabled);
// }
//
// @Override
// public String toString() {
// return "DataSetListResult{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", owner=" + owner +
// ", dataCurrentAt='" + dataCurrentAt + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", pdpEnabled=" + pdpEnabled +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSetListResult;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
package com.domo.sdk.datasets;
public class ListExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//List DS
String sortBy = "name";
int limit = 5;
int offset = 0; | List<DataSetListResult> list = dsClient.list(sortBy, limit, offset); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException;
import java.util.List; | package com.domo.sdk.streams;
public class ListExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
//List Streams
int limit = 500;
int offset = 0; | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
package com.domo.sdk.streams;
public class ListExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
//List Streams
int limit = 500;
int offset = 0; | List<Stream> listedSds = sdsClient.list(limit, offset); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
| Stream sds = CreateExample.createStream(sdsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
Stream sds = CreateExample.createStream(sdsClient);
System.out.println("Created:" + sds);
//Update Stream to REPLACE | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
Stream sds = CreateExample.createStream(sdsClient);
System.out.println("Created:" + sds);
//Update Stream to REPLACE | StreamRequest sdsRequest = new StreamRequest(); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
Stream sds = CreateExample.createStream(sdsClient);
System.out.println("Created:" + sds);
//Update Stream to REPLACE
StreamRequest sdsRequest = new StreamRequest(); | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
// public class Stream {
//
// private long id;
// private DataSet dataSet;
// private String updateMethod;
// private String createdAt;
// private String modifiedAt;
//
// public Stream(){
// this.id = 0;
// this.dataSet = new DataSet();
// this.createdAt = "";
// this.modifiedAt = "";
// }
//
// public long getId() {
// return id;
// }
//
// public void setId( long id ) {
// this.id = id;
// }
//
// public DataSet getDataset() {
// return dataSet;
// }
//
// public void setDataset( DataSet dataset ) {
// this.dataSet = dataset;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt( String createdAt ) {
// this.createdAt = createdAt;
// }
//
// public String getModifiedAt() {
// return modifiedAt;
// }
//
// public void setModifiedAt( String modifiedAt ) {
// this.modifiedAt = modifiedAt;
// }
//
// @Override
// public boolean equals( Object o ) {
// if (this == o) {
// return true;
// }
// if (o == null || getClass() != o.getClass()) {
// return false;
// }
//
// Stream that = (Stream) o;
//
// if (getId() != that.getId()) {
// return false;
// }
// if (getDataset() != null ? !getDataset().equals(that.getDataset()) : that.getDataset() != null) {
// return false;
// }
// if (getUpdateMethod() != null ? !getUpdateMethod().equals(that.getUpdateMethod()) : that.getUpdateMethod() != null) {
// return false;
// }
// if (getCreatedAt() != null ? !getCreatedAt().equals(that.getCreatedAt()) : that.getCreatedAt() != null) {
// return false;
// }
// return getModifiedAt() != null ? getModifiedAt().equals(that.getModifiedAt()) : that.getModifiedAt() == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) ( getId() ^ ( getId() >>> 32 ) );
// result = 31 * result + ( getDataset() != null ? getDataset().hashCode() : 0 );
// result = 31 * result + ( getUpdateMethod() != null ? getUpdateMethod().hashCode() : 0 );
// result = 31 * result + ( getCreatedAt() != null ? getCreatedAt().hashCode() : 0 );
// result = 31 * result + ( getModifiedAt() != null ? getModifiedAt().hashCode() : 0 );
// return result;
// }
//
// @Override
// public String toString() {
// return "StreamDataSet{" +
// "id='" + id + '\'' +
// ", dataset=" + dataSet.toString() +
// ", updateMethod='" + updateMethod + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", modifiedAt='" + modifiedAt + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/StreamRequest.java
// public class StreamRequest {
//
// private CreateDataSetRequest dataSet;
// private String updateMethod;
//
// public StreamRequest(){
// this.dataSet = new CreateDataSetRequest();
// this.updateMethod = UpdateMethod.APPEND;
// }
//
// public CreateDataSetRequest getDataSet() {
// return dataSet;
// }
//
// public void setDataSet( CreateDataSetRequest dataSet ) {
// this.dataSet = dataSet;
// }
//
// public String getUpdateMethod() {
// return updateMethod;
// }
//
// public void setUpdateMethod( String updateMethod ) {
// this.updateMethod = updateMethod;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/UpdateMethod.java
// public class UpdateMethod {
// public static final String APPEND = "APPEND";
// public static final String REPLACE = "REPLACE";
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/streams/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.streams.model.Stream;
import com.domo.sdk.streams.model.StreamRequest;
import com.domo.sdk.streams.model.UpdateMethod;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.streams;
public class UpdateExample extends ExampleBase {
@Test
public void streamClient_smokeTest() throws IOException {
StreamClient sdsClient = client.streamClient();
Stream sds = CreateExample.createStream(sdsClient);
System.out.println("Created:" + sds);
//Update Stream to REPLACE
StreamRequest sdsRequest = new StreamRequest(); | sdsRequest.setUpdateMethod(UpdateMethod.REPLACE); //Only the stream metadata fields can be updated, not the dataSet metadata |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.users;
public class RetrieveExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.users;
public class RetrieveExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | User user = CreateExample.create(userClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/Column.java
// public class Column {
// private ColumnType type;
// private String name;
//
// public Column(ColumnType type, String name) {
// this.type = type;
// this.name = name;
// }
//
// public ColumnType getType() {
// return type;
// }
//
// public void setType(ColumnType type) {
// this.type = type;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Column{" +
// "type=" + type +
// ", name='" + name + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.Column;
import com.domo.sdk.datasets.model.DataSet;
import org.assertj.core.util.Lists;
import org.junit.Test;
import java.io.IOException;
import static com.domo.sdk.datasets.model.ColumnType.STRING; | package com.domo.sdk.datasets;
public class UpdateExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/Column.java
// public class Column {
// private ColumnType type;
// private String name;
//
// public Column(ColumnType type, String name) {
// this.type = type;
// this.name = name;
// }
//
// public ColumnType getType() {
// return type;
// }
//
// public void setType(ColumnType type) {
// this.type = type;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Column{" +
// "type=" + type +
// ", name='" + name + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.Column;
import com.domo.sdk.datasets.model.DataSet;
import org.assertj.core.util.Lists;
import org.junit.Test;
import java.io.IOException;
import static com.domo.sdk.datasets.model.ColumnType.STRING;
package com.domo.sdk.datasets;
public class UpdateExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | DataSet ds = CreateExample.create(dsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/Column.java
// public class Column {
// private ColumnType type;
// private String name;
//
// public Column(ColumnType type, String name) {
// this.type = type;
// this.name = name;
// }
//
// public ColumnType getType() {
// return type;
// }
//
// public void setType(ColumnType type) {
// this.type = type;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Column{" +
// "type=" + type +
// ", name='" + name + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.Column;
import com.domo.sdk.datasets.model.DataSet;
import org.assertj.core.util.Lists;
import org.junit.Test;
import java.io.IOException;
import static com.domo.sdk.datasets.model.ColumnType.STRING; | package com.domo.sdk.datasets;
public class UpdateExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS
DataSet ds = CreateExample.create(dsClient);
System.out.println("Created:" + ds);
//Update DS
ds.setName("Leonhard Euler Party - Update");
ds.setDescription("Mathematician Guest List - Update"); | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/Column.java
// public class Column {
// private ColumnType type;
// private String name;
//
// public Column(ColumnType type, String name) {
// this.type = type;
// this.name = name;
// }
//
// public ColumnType getType() {
// return type;
// }
//
// public void setType(ColumnType type) {
// this.type = type;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Column{" +
// "type=" + type +
// ", name='" + name + '\'' +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.Column;
import com.domo.sdk.datasets.model.DataSet;
import org.assertj.core.util.Lists;
import org.junit.Test;
import java.io.IOException;
import static com.domo.sdk.datasets.model.ColumnType.STRING;
package com.domo.sdk.datasets;
public class UpdateExample extends ExampleBase {
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS
DataSet ds = CreateExample.create(dsClient);
System.out.println("Created:" + ds);
//Update DS
ds.setName("Leonhard Euler Party - Update");
ds.setDescription("Mathematician Guest List - Update"); | ds.getSchema().setColumns(Lists.newArrayList(new Column(STRING, "Friend"), new Column(STRING, "Attending"), new Column(STRING, "Favorite Shape"))); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/CreateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/CreateUserRequest.java
// public class CreateUserRequest {
// private String email;
// private String role;
// private String name;
//
// public CreateUserRequest() {
// }
//
// public CreateUserRequest(String email, String role, String name) {
// this.email = email;
// this.role = role;
// this.name = name;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// CreateUserRequest user = (CreateUserRequest) o;
// return Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(email, role, name);
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.CreateUserRequest;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.users;
public class CreateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
create(userClient);
}
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/CreateUserRequest.java
// public class CreateUserRequest {
// private String email;
// private String role;
// private String name;
//
// public CreateUserRequest() {
// }
//
// public CreateUserRequest(String email, String role, String name) {
// this.email = email;
// this.role = role;
// this.name = name;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// CreateUserRequest user = (CreateUserRequest) o;
// return Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(email, role, name);
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/CreateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.CreateUserRequest;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.users;
public class CreateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
create(userClient);
}
| public static User create(UserClient userClient) { |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/CreateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/CreateUserRequest.java
// public class CreateUserRequest {
// private String email;
// private String role;
// private String name;
//
// public CreateUserRequest() {
// }
//
// public CreateUserRequest(String email, String role, String name) {
// this.email = email;
// this.role = role;
// this.name = name;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// CreateUserRequest user = (CreateUserRequest) o;
// return Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(email, role, name);
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.CreateUserRequest;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.users;
public class CreateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
create(userClient);
}
public static User create(UserClient userClient) {
// Build a User request | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/CreateUserRequest.java
// public class CreateUserRequest {
// private String email;
// private String role;
// private String name;
//
// public CreateUserRequest() {
// }
//
// public CreateUserRequest(String email, String role, String name) {
// this.email = email;
// this.role = role;
// this.name = name;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// CreateUserRequest user = (CreateUserRequest) o;
// return Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(email, role, name);
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/CreateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.CreateUserRequest;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.users;
public class CreateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
create(userClient);
}
public static User create(UserClient userClient) {
// Build a User request | CreateUserRequest request = new CreateUserRequest(); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/main/java/com/domo/sdk/request/Transport.java | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/tasks/model/Attachment.java
// public class Attachment {
//
// private Long id;
// private Long taskId;
// private String createdDate;
// private Long createdBy;
// private String fileName;
// private String mimeType;
//
// public Long getId() { return id; }
//
// public void setId(Long id) { this.id = id; }
//
// public Long getTaskId() { return taskId; }
//
// public void setTaskId(Long taskId) { this.taskId = taskId; }
//
// public String getCreatedDate() { return createdDate; }
//
// public void setCreatedDate(String createdDate) { this.createdDate = createdDate; }
//
// public Long getCreatedBy() { return createdBy; }
//
// public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; }
//
// public String getFileName() { return fileName; }
//
// public void setFileName(String fileName) { this.fileName = fileName; }
//
// public String getMimeType() { return mimeType; }
//
// public void setMimeType(String mimeType) { this.mimeType = mimeType; }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Attachment that = (Attachment) o;
// return Objects.equals(id, that.id) &&
// Objects.equals(taskId, that.taskId) &&
// Objects.equals(createdDate, that.createdDate) &&
// Objects.equals(createdBy, that.createdBy) &&
// Objects.equals(fileName, that.fileName) &&
// Objects.equals(mimeType, that.mimeType);
// }
//
// @Override
// public int hashCode() {
//
// return Objects.hash(id, taskId, createdDate, createdBy, fileName, mimeType);
// }
// }
| import com.domo.sdk.tasks.model.Attachment;
import com.google.gson.Gson;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import javax.activation.MimetypesFileTypeMap;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type; | }
private void putCsvInternal(HttpUrl url, RequestBody requestBody) {
Request request = new Request.Builder()
.header("Content-Type", "text/csv")
.url(url)
.put(requestBody)
.build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new RequestException("Error uploading csv. url:"+url.toString()+" responseBody:"+response.body().source().readUtf8());
}
} catch (IOException e) {
throw new RequestException("Error uploading csv. url:"+url.toString(), e);
}
}
public InputStream getFile(HttpUrl url){
Request request = new Request.Builder().url(url).build();
try {
Response response = httpClient.newCall(request).execute();
return new ByteArrayInputStream(response.body().bytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
| // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/tasks/model/Attachment.java
// public class Attachment {
//
// private Long id;
// private Long taskId;
// private String createdDate;
// private Long createdBy;
// private String fileName;
// private String mimeType;
//
// public Long getId() { return id; }
//
// public void setId(Long id) { this.id = id; }
//
// public Long getTaskId() { return taskId; }
//
// public void setTaskId(Long taskId) { this.taskId = taskId; }
//
// public String getCreatedDate() { return createdDate; }
//
// public void setCreatedDate(String createdDate) { this.createdDate = createdDate; }
//
// public Long getCreatedBy() { return createdBy; }
//
// public void setCreatedBy(Long createdBy) { this.createdBy = createdBy; }
//
// public String getFileName() { return fileName; }
//
// public void setFileName(String fileName) { this.fileName = fileName; }
//
// public String getMimeType() { return mimeType; }
//
// public void setMimeType(String mimeType) { this.mimeType = mimeType; }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// Attachment that = (Attachment) o;
// return Objects.equals(id, that.id) &&
// Objects.equals(taskId, that.taskId) &&
// Objects.equals(createdDate, that.createdDate) &&
// Objects.equals(createdBy, that.createdBy) &&
// Objects.equals(fileName, that.fileName) &&
// Objects.equals(mimeType, that.mimeType);
// }
//
// @Override
// public int hashCode() {
//
// return Objects.hash(id, taskId, createdDate, createdBy, fileName, mimeType);
// }
// }
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/request/Transport.java
import com.domo.sdk.tasks.model.Attachment;
import com.google.gson.Gson;
import okhttp3.HttpUrl;
import okhttp3.MediaType;
import okhttp3.MultipartBody;
import okhttp3.OkHttpClient;
import okhttp3.Request;
import okhttp3.RequestBody;
import okhttp3.Response;
import javax.activation.MimetypesFileTypeMap;
import java.io.ByteArrayInputStream;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.lang.reflect.Type;
}
private void putCsvInternal(HttpUrl url, RequestBody requestBody) {
Request request = new Request.Builder()
.header("Content-Type", "text/csv")
.url(url)
.put(requestBody)
.build();
try (Response response = httpClient.newCall(request).execute()) {
if (!response.isSuccessful()) {
throw new RequestException("Error uploading csv. url:"+url.toString()+" responseBody:"+response.body().source().readUtf8());
}
} catch (IOException e) {
throw new RequestException("Error uploading csv. url:"+url.toString(), e);
}
}
public InputStream getFile(HttpUrl url){
Request request = new Request.Builder().url(url).build();
try {
Response response = httpClient.newCall(request).execute();
return new ByteArrayInputStream(response.body().bytes());
} catch (IOException e) {
throw new RuntimeException(e);
}
}
| public Attachment uploadFile(HttpUrl url, String filePath){ |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.datasets;
public class DeleteExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.datasets;
public class DeleteExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | DataSet ds = CreateExample.create(dsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/pages/CreateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.pages;
public class CreateExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
create(pageClient);
}
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/pages/CreateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.pages;
public class CreateExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
create(pageClient);
}
| public static Page create(PageClient pageClient) { |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ImportDataExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.datasets;
public class ImportDataExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ImportDataExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.datasets;
public class ImportDataExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
//Create DS | DataSet ds = CreateExample.create(dsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/request/Config.java
// public class Config {
// private static final Logger LOG = LoggerFactory.getLogger(Config.class);
// private final String clientId;
// private final String secret;
// private final List<Scope> scopes;
// private String apiHost;
// private boolean useHttps = true;
// private final OkHttpClient httpClient;
// private HttpLoggingInterceptor.Level httpLoggingLevel;
//
// public Config(String clientId,
// String secret,
// String apiHost,
// boolean useHttps,
// List<Scope> scopes,
// OkHttpClient httpClient,
// HttpLoggingInterceptor.Level httpLoggingLevel) {
// this.clientId = clientId;
// this.secret = secret;
// this.scopes = Collections.unmodifiableList(scopes);
// this.apiHost = stripPrefix(apiHost);
// this.useHttps = useHttps;
// this.httpLoggingLevel = httpLoggingLevel;
//
// if(httpClient == null) {
// throw new IllegalStateException("HttpClient is required");
// }
// this.httpClient = httpClient;
// }
//
// // Visible for testing.
// String stripPrefix(String apiHost) {
// String httpPrefix = "http://";
// String httpsPrefix = "https://";
// if(apiHost.toLowerCase().startsWith(httpPrefix)) {
// LOG.warn("Ignoring http hpiHost scheme, set 'useHttps' to false for http");
// return apiHost.substring(httpPrefix.length());
// } else if(apiHost.toLowerCase().startsWith(httpsPrefix)) {
// return apiHost.substring(httpsPrefix.length());
// } else {
// return apiHost;
// }
// }
//
// public String getClientId() {
// return clientId;
// }
//
// public String getSecret() {
// return secret;
// }
//
// public String getApiHost() {
// return apiHost;
// }
//
// public boolean useHttps() {
// return useHttps;
// }
//
// public List<Scope> getScopes() {
// return scopes;
// }
//
// public OkHttpClient okHttpClient() { return httpClient;}
//
// public HttpLoggingInterceptor.Level level() { return httpLoggingLevel;}
//
// public static Builder with(){
// return new Builder();
// }
//
// public static class Builder{
// private String clientId;
// private String secret;
// private String apiHost = "api.domo.com";
// private boolean useHttps = true;
// private List<Scope> scopes = new ArrayList<>();
// private OkHttpClient httpClient;
//
// private AtomicReference<Config> configRef = new AtomicReference<>();
// private HttpLoggingInterceptor logging = new HttpLoggingInterceptor(new Slf4jLoggingInterceptor());
//
// public Builder() {
// }
//
// public OkHttpClient.Builder defaultHttpClientBuilder() {
// return new OkHttpClient.Builder()
// .readTimeout(60, TimeUnit.SECONDS)
// .addInterceptor(new OAuthInterceptor(new UrlBuilder(configRef), configRef))
// .addInterceptor(logging);
// }
//
// public Builder clientId(String clientId) {
// this.clientId = clientId;
// return this;
// }
//
// public Builder clientSecret(String secret) {
// this.secret = secret;
// return this;
// }
//
// public Builder apiHost(String apiHost) {
// this.apiHost = apiHost;
// return this;
// }
//
// public Builder useHttps(boolean useHttps) {
// this.useHttps = useHttps;
// return this;
// }
//
// public Builder httpClient(OkHttpClient httpClient) {
// this.httpClient = httpClient;
// return this;
// }
//
// public Builder httpLoggingLevel(HttpLoggingInterceptor.Level level) {
// logging.setLevel(level);
// return this;
// }
//
// public Config build(){
// require("Client ID", clientId);
// require("Client Secret", secret);
// if(scopes.isEmpty()) {
// throw new ConfigException("At lease one scope is required");
// }
//
// OkHttpClient client = this.httpClient;
// if(client == null) {
// client = defaultHttpClientBuilder().build();
// }
//
// Config conf = new Config(this.clientId,
// this.secret,
// this.apiHost,
// this.useHttps,
// this.scopes,
// client,
// this.logging.getLevel());
// configRef.set(conf);
// return conf;
// }
//
// private void require(String name, String value){
// if(value == null){
// throw new ConfigException(name + " must not be null");
// }
// }
//
// public Builder scope(Scope... newScopes) {
// scopes.clear();
// Collections.addAll(scopes, newScopes);
// return this;
// }
// }
// }
| import com.domo.sdk.request.Config;
import okhttp3.logging.HttpLoggingInterceptor;
import org.junit.Before;
import static com.domo.sdk.request.Scope.DATA;
import static com.domo.sdk.request.Scope.USER;
import static com.domo.sdk.request.Scope.WORKFLOW; | package com.domo.sdk;
public class ExampleBase {
protected DomoClient client;
@Before
public void setup() { | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/request/Config.java
// public class Config {
// private static final Logger LOG = LoggerFactory.getLogger(Config.class);
// private final String clientId;
// private final String secret;
// private final List<Scope> scopes;
// private String apiHost;
// private boolean useHttps = true;
// private final OkHttpClient httpClient;
// private HttpLoggingInterceptor.Level httpLoggingLevel;
//
// public Config(String clientId,
// String secret,
// String apiHost,
// boolean useHttps,
// List<Scope> scopes,
// OkHttpClient httpClient,
// HttpLoggingInterceptor.Level httpLoggingLevel) {
// this.clientId = clientId;
// this.secret = secret;
// this.scopes = Collections.unmodifiableList(scopes);
// this.apiHost = stripPrefix(apiHost);
// this.useHttps = useHttps;
// this.httpLoggingLevel = httpLoggingLevel;
//
// if(httpClient == null) {
// throw new IllegalStateException("HttpClient is required");
// }
// this.httpClient = httpClient;
// }
//
// // Visible for testing.
// String stripPrefix(String apiHost) {
// String httpPrefix = "http://";
// String httpsPrefix = "https://";
// if(apiHost.toLowerCase().startsWith(httpPrefix)) {
// LOG.warn("Ignoring http hpiHost scheme, set 'useHttps' to false for http");
// return apiHost.substring(httpPrefix.length());
// } else if(apiHost.toLowerCase().startsWith(httpsPrefix)) {
// return apiHost.substring(httpsPrefix.length());
// } else {
// return apiHost;
// }
// }
//
// public String getClientId() {
// return clientId;
// }
//
// public String getSecret() {
// return secret;
// }
//
// public String getApiHost() {
// return apiHost;
// }
//
// public boolean useHttps() {
// return useHttps;
// }
//
// public List<Scope> getScopes() {
// return scopes;
// }
//
// public OkHttpClient okHttpClient() { return httpClient;}
//
// public HttpLoggingInterceptor.Level level() { return httpLoggingLevel;}
//
// public static Builder with(){
// return new Builder();
// }
//
// public static class Builder{
// private String clientId;
// private String secret;
// private String apiHost = "api.domo.com";
// private boolean useHttps = true;
// private List<Scope> scopes = new ArrayList<>();
// private OkHttpClient httpClient;
//
// private AtomicReference<Config> configRef = new AtomicReference<>();
// private HttpLoggingInterceptor logging = new HttpLoggingInterceptor(new Slf4jLoggingInterceptor());
//
// public Builder() {
// }
//
// public OkHttpClient.Builder defaultHttpClientBuilder() {
// return new OkHttpClient.Builder()
// .readTimeout(60, TimeUnit.SECONDS)
// .addInterceptor(new OAuthInterceptor(new UrlBuilder(configRef), configRef))
// .addInterceptor(logging);
// }
//
// public Builder clientId(String clientId) {
// this.clientId = clientId;
// return this;
// }
//
// public Builder clientSecret(String secret) {
// this.secret = secret;
// return this;
// }
//
// public Builder apiHost(String apiHost) {
// this.apiHost = apiHost;
// return this;
// }
//
// public Builder useHttps(boolean useHttps) {
// this.useHttps = useHttps;
// return this;
// }
//
// public Builder httpClient(OkHttpClient httpClient) {
// this.httpClient = httpClient;
// return this;
// }
//
// public Builder httpLoggingLevel(HttpLoggingInterceptor.Level level) {
// logging.setLevel(level);
// return this;
// }
//
// public Config build(){
// require("Client ID", clientId);
// require("Client Secret", secret);
// if(scopes.isEmpty()) {
// throw new ConfigException("At lease one scope is required");
// }
//
// OkHttpClient client = this.httpClient;
// if(client == null) {
// client = defaultHttpClientBuilder().build();
// }
//
// Config conf = new Config(this.clientId,
// this.secret,
// this.apiHost,
// this.useHttps,
// this.scopes,
// client,
// this.logging.getLevel());
// configRef.set(conf);
// return conf;
// }
//
// private void require(String name, String value){
// if(value == null){
// throw new ConfigException(name + " must not be null");
// }
// }
//
// public Builder scope(Scope... newScopes) {
// scopes.clear();
// Collections.addAll(scopes, newScopes);
// return this;
// }
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
import com.domo.sdk.request.Config;
import okhttp3.logging.HttpLoggingInterceptor;
import org.junit.Before;
import static com.domo.sdk.request.Scope.DATA;
import static com.domo.sdk.request.Scope.USER;
import static com.domo.sdk.request.Scope.WORKFLOW;
package com.domo.sdk;
public class ExampleBase {
protected DomoClient client;
@Before
public void setup() { | Config config = Config.with() |
domoinc/domo-java-sdk | domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/hal/Templates.java
// public final class Templates {
//
// @SerializedName("default")
// private Template defaultTemplate;
//
// public Template getDefaultTemplate() {
// return defaultTemplate;
// }
//
// public void setDefaultTemplate(final Template defaultTemplate) {
// this.defaultTemplate = defaultTemplate;
// }
// }
| import com.domo.sdk.accounts.hal.Templates;
import java.util.Map; | package com.domo.sdk.accounts.model;
public final class AccountType {
private String id;
private String name; | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/hal/Templates.java
// public final class Templates {
//
// @SerializedName("default")
// private Template defaultTemplate;
//
// public Template getDefaultTemplate() {
// return defaultTemplate;
// }
//
// public void setDefaultTemplate(final Template defaultTemplate) {
// this.defaultTemplate = defaultTemplate;
// }
// }
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
import com.domo.sdk.accounts.hal.Templates;
import java.util.Map;
package com.domo.sdk.accounts.model;
public final class AccountType {
private String id;
private String name; | private Templates _templates; |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test; | package com.domo.sdk.groups;
public class RetrieveExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test;
package com.domo.sdk.groups;
public class RetrieveExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | Group group = CreateExample.createGroup(gClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test;
import java.util.List; | package com.domo.sdk.groups;
public class ListExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import org.junit.Test;
import java.util.List;
package com.domo.sdk.groups;
public class ListExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
| List<Group> list = gClient.list(10, 0); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.datasets.model.DataSet; | package com.domo.sdk.streams.model;
/**
* Created by bobbyswingler on 3/10/17.
*/
public class Stream {
private long id; | // Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/streams/model/Stream.java
import com.domo.sdk.datasets.model.DataSet;
package com.domo.sdk.streams.model;
/**
* Created by bobbyswingler on 3/10/17.
*/
public class Stream {
private long id; | private DataSet dataSet; |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.users;
public class DeleteExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.users;
public class DeleteExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | User user = CreateExample.create(userClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/CreateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.accounts;
public class CreateExample extends ExampleBase {
@Test
public void create_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/CreateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.accounts;
public class CreateExample extends ExampleBase {
@Test
public void create_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| Account account = createAccount(accountClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ExportDataExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.InputStream; | package com.domo.sdk.datasets;
public class ExportDataExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
String dataSetId = setupDataSet(dsClient);
//Export DS
InputStream stream = dsClient.exportData(dataSetId,true);
String data = convertStreamToString(stream);
stream.close();
System.out.println(data);
//Export to file
File f = File.createTempFile("sample-export", ".csv");
dsClient.exportDataToFile(dataSetId,true, f);
System.out.println("Wrote out file:"+f.getAbsolutePath());
}
private String setupDataSet(DataSetClient dsClient) {
//Create DS | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/datasets/model/DataSet.java
// public class DataSet {
// private String id;
// private String name;
// private String description;
// private long rows;
// private long columns;
// private Schema schema;
// private Owner owner;
// private String createdAt;
// private String updatedAt;
//
// public DataSet() {
// this.id = "";
// this.name = "";
// this.description = "";
// this.rows = 0;
// this.columns = 0;
// this.schema = new Schema();
// this.owner = new Owner();
// this.createdAt = "";
// this.updatedAt = "";
// }
//
// public String getId() {
// return id;
// }
//
// public void setId(String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getDescription() {
// return description;
// }
//
// public void setDescription(String description) {
// this.description = description;
// }
//
// public long getRows() {
// return rows;
// }
//
// public void setRows(long rows) {
// this.rows = rows;
// }
//
// public long getColumns() {
// return columns;
// }
//
// public void setColumns(long columns) {
// this.columns = columns;
// }
//
// public Schema getSchema() {
// return schema;
// }
//
// public void setSchema(Schema schema) {
// this.schema = schema;
// }
//
// public Owner getOwner() {
// return owner;
// }
//
// public void setOwner(Owner owner) {
// this.owner = owner;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// DataSet dataSet = (DataSet) o;
// return rows == dataSet.rows &&
// columns == dataSet.columns &&
// Objects.equals(id, dataSet.id) &&
// Objects.equals(name, dataSet.name) &&
// Objects.equals(description, dataSet.description) &&
// Objects.equals(schema, dataSet.schema) &&
// Objects.equals(owner, dataSet.owner) &&
// Objects.equals(createdAt, dataSet.createdAt) &&
// Objects.equals(updatedAt, dataSet.updatedAt);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, name, description, rows, columns, schema, owner, createdAt, updatedAt);
// }
//
// @Override
// public String toString() {
// return "DataSet{" +
// "id='" + id + '\'' +
// ", name='" + name + '\'' +
// ", description='" + description + '\'' +
// ", rows=" + rows +
// ", columns=" + columns +
// ", schema=" + schema.toString() +
// ", owner=" + owner +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// '}';
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/datasets/ExportDataExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.datasets.model.DataSet;
import org.junit.Test;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
package com.domo.sdk.datasets;
public class ExportDataExample extends ExampleBase{
@Test
public void dataSetClient_smokeTest() throws IOException {
DataSetClient dsClient = client.dataSetClient();
String dataSetId = setupDataSet(dsClient);
//Export DS
InputStream stream = dsClient.exportData(dataSetId,true);
String data = convertStreamToString(stream);
stream.close();
System.out.println(data);
//Export to file
File f = File.createTempFile("sample-export", ".csv");
dsClient.exportDataToFile(dataSetId,true, f);
System.out.println("Wrote out file:"+f.getAbsolutePath());
}
private String setupDataSet(DataSetClient dsClient) {
//Create DS | DataSet ds = CreateExample.create(dsClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/DeleteExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.accounts;
public class DeleteExample extends ExampleBase {
@Test
public void create_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/DeleteExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.accounts;
public class DeleteExample extends ExampleBase {
@Test
public void create_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| Account account = CreateExample.createAccount(accountClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
import java.util.List; | package com.domo.sdk.users;
public class ListExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//List Users | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
package com.domo.sdk.users;
public class ListExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//List Users | List<User> list = userClient.list(30, 0); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/pages/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.pages;
public class UpdateExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/pages/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.pages;
public class UpdateExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| Page page = CreateExample.create(pageClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/pages/RetrieveExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.pages;
public class RetrieveExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/pages/model/Page.java
// public class Page {
// private long id;
// private String name;
// private long parentId;
// private long ownerId;
// private Boolean locked;
// private List<Long> collectionIds;
// private List<Long> cardIds;
// private PageVisibility visibility;
//
// public long getId() {
// return id;
// }
//
// public void setId(long id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public long getParentId() {
// return parentId;
// }
//
// public void setParentId(long parentId) {
// this.parentId = parentId;
// }
//
// public long getOwnerId() {
// return ownerId;
// }
//
// public void setOwnerId(long ownerId) {
// this.ownerId = ownerId;
// }
//
// public Boolean getLocked() {
// return locked;
// }
//
// public void setLocked(Boolean locked) {
// this.locked = locked;
// }
//
// public List<Long> getCollectionIds() {
// return collectionIds;
// }
//
// public void setCollectionIds(List<Long> collectionIds) {
// this.collectionIds = collectionIds;
// }
//
// public List<Long> getCardIds() {
// return cardIds;
// }
//
// public void setCardIds(List<Long> cardIds) {
// this.cardIds = cardIds;
// }
//
// public PageVisibility getVisibility() {
// return visibility;
// }
//
// public void setVisibility(PageVisibility visibility) {
// this.visibility = visibility;
// }
//
// /**
// * Helper for building new pages
// */
// public static class Builder {
// private Page toBuild;
//
// public Builder(String pageName) {
// toBuild = new Page();
// toBuild.setName(pageName);
// }
//
// public Builder setParentId(long parentId) {
// toBuild.setParentId(parentId);
// return this;
// }
//
// public Builder setOwnerId(long ownerId) {
// toBuild.setOwnerId(ownerId);
// return this;
// }
//
// public Builder setLocked(boolean locked) {
// toBuild.setLocked(locked);
// return this;
// }
//
// public Builder setCardIds(List<Long> cardIds) {
// toBuild.setCardIds(cardIds);
// return this;
// }
//
// public Builder setPageVisibility(PageVisibility pageVisibility) {
// toBuild.setVisibility(pageVisibility);
// return this;
// }
//
// public Page build() {
// return toBuild;
// }
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (!(o instanceof Page)) return false;
//
// Page page = (Page) o;
//
// if (id != page.id) return false;
// if (parentId != page.parentId) return false;
// if (ownerId != page.ownerId) return false;
// if (!name.equals(page.name)) return false;
// if (locked != null ? !locked.equals(page.locked) : page.locked != null) return false;
// if (collectionIds != null ? !collectionIds.equals(page.collectionIds) : page.collectionIds != null)
// return false;
// if (cardIds != null ? !cardIds.equals(page.cardIds) : page.cardIds != null) return false;
// return visibility != null ? visibility.equals(page.visibility) : page.visibility == null;
// }
//
// @Override
// public int hashCode() {
// int result = (int) (id ^ (id >>> 32));
// result = 31 * result + name.hashCode();
// result = 31 * result + (int) (parentId ^ (parentId >>> 32));
// result = 31 * result + (int) (ownerId ^ (ownerId >>> 32));
// result = 31 * result + (locked != null ? locked.hashCode() : 0);
// result = 31 * result + (collectionIds != null ? collectionIds.hashCode() : 0);
// result = 31 * result + (cardIds != null ? cardIds.hashCode() : 0);
// result = 31 * result + (visibility != null ? visibility.hashCode() : 0);
// return result;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/pages/RetrieveExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.pages.model.Page;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.pages;
public class RetrieveExample extends ExampleBase {
@Test
public void pageClient_smokeTest() throws IOException {
PageClient pageClient = client.pageClient();
| Page page = CreateExample.create(pageClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/users/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.users;
public class UpdateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/users/model/User.java
// public class User {
// private Long id;
// private String email;
// private String role;
// private String name;
// private String createdAt;
// private String updatedAt;
// private String image;
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public String getEmail() {
// return email;
// }
//
// public void setEmail(String email) {
// this.email = email;
// }
//
// public String getRole() {
// return role;
// }
//
// public void setRole(String role) {
// this.role = role;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public String getCreatedAt() {
// return createdAt;
// }
//
// public void setCreatedAt(String createdAt) {
// this.createdAt = createdAt;
// }
//
// public String getUpdatedAt() {
// return updatedAt;
// }
//
// public void setUpdatedAt(String updatedAt) {
// this.updatedAt = updatedAt;
// }
//
// public String getImage() {
// return image;
// }
//
// public void setImage(String image) {
// this.image = image;
// }
//
// @Override
// public String toString() {
// return "User{" +
// "id=" + id +
// ", email='" + email + '\'' +
// ", role='" + role + '\'' +
// ", name='" + name + '\'' +
// ", createdAt='" + createdAt + '\'' +
// ", updatedAt='" + updatedAt + '\'' +
// ", image='" + image + '\'' +
// '}';
// }
//
// @Override
// public boolean equals(Object o) {
// if (this == o) return true;
// if (o == null || getClass() != o.getClass()) return false;
// User user = (User) o;
// return Objects.equals(id, user.id) &&
// Objects.equals(email, user.email) &&
// Objects.equals(role, user.role) &&
// Objects.equals(name, user.name) &&
// Objects.equals(createdAt, user.createdAt) &&
// Objects.equals(updatedAt, user.updatedAt) &&
// Objects.equals(image, user.image);
// }
//
// @Override
// public int hashCode() {
// return Objects.hash(id, email, role, name, createdAt, updatedAt, image);
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/users/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.users.model.User;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.users;
public class UpdateExample extends ExampleBase {
@Test
public void userClient_smokeTest() throws IOException {
UserClient userClient = client.userClient();
//Create a user | User user = CreateExample.create(userClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
import java.util.List; | package com.domo.sdk.accounts;
public class ListExample extends ExampleBase {
@Test
public void list_accounts_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0; | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
package com.domo.sdk.accounts;
public class ListExample extends ExampleBase {
@Test
public void list_accounts_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0; | List<Account> list = accountClient.list(sortBy, limit, offset); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/ListExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
import java.util.List; | package com.domo.sdk.accounts;
public class ListExample extends ExampleBase {
@Test
public void list_accounts_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0;
List<Account> list = accountClient.list(sortBy, limit, offset);
System.out.println("Account list: " + list);
}
@Test
public void list_account_types_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0; | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/AccountType.java
// public final class AccountType {
//
// private String id;
// private String name;
// private Templates _templates;
// private Map<String, String> properties;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Templates get_templates() {
// return _templates;
// }
//
// public void set_templates(final Templates _templates) {
// this._templates = _templates;
// }
//
// public Map<String, String> getProperties() {
// return properties;
// }
//
// public void setProperties(final Map<String, String> properties) {
// this.properties = properties;
// }
//
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/ListExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import com.domo.sdk.accounts.model.AccountType;
import org.junit.Test;
import java.io.IOException;
import java.util.List;
package com.domo.sdk.accounts;
public class ListExample extends ExampleBase {
@Test
public void list_accounts_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0;
List<Account> list = accountClient.list(sortBy, limit, offset);
System.out.println("Account list: " + list);
}
@Test
public void list_account_types_example() throws IOException {
AccountClient accountClient = client.accountClient();
String sortBy = "name";
int limit = 5;
int offset = 0; | List<AccountType> list = accountClient.listAccountTypes(sortBy, limit, offset); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException; | package com.domo.sdk.accounts;
public class UpdateExample extends ExampleBase {
@Test
public void update_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/accounts/model/Account.java
// public final class Account {
//
// private String id, name;
// private Boolean valid;
// private AccountType type;
//
// public String getId() {
// return id;
// }
//
// public void setId(final String id) {
// this.id = id;
// }
//
// public String getName() {
// return name;
// }
//
// public void setName(final String name) {
// this.name = name;
// }
//
// public Boolean isValid() {
// return valid;
// }
//
// public void setValid(final Boolean valid) {
// this.valid = valid;
// }
//
// public AccountType getType() {
// return type;
// }
//
// public void setType(final AccountType type) {
// this.type = type;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/accounts/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.accounts.model.Account;
import org.junit.Test;
import java.io.IOException;
package com.domo.sdk.accounts;
public class UpdateExample extends ExampleBase {
@Test
public void update_account_example() throws IOException {
AccountClient accountClient = client.accountClient();
| Account account = createAccount(accountClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/UpdateGroupRequest.java
// public class UpdateGroupRequest {
//
// private String name;
// private boolean active = true;
//
// @SerializedName("default")
// private boolean isDefault;
// private long memberCount;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public boolean isDefault() {
// return isDefault;
// }
//
// public void setDefault(boolean aDefault) {
// isDefault = aDefault;
// }
//
// public boolean isActive() {
// return active;
// }
//
// public void setActive(boolean active) {
// this.active = active;
// }
//
// public long getMemberCount() {
// return memberCount;
// }
//
// public void setMemberCount(long memberCount) {
// this.memberCount = memberCount;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import com.domo.sdk.groups.model.UpdateGroupRequest;
import org.junit.Test; | package com.domo.sdk.groups;
public class UpdateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/UpdateGroupRequest.java
// public class UpdateGroupRequest {
//
// private String name;
// private boolean active = true;
//
// @SerializedName("default")
// private boolean isDefault;
// private long memberCount;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public boolean isDefault() {
// return isDefault;
// }
//
// public void setDefault(boolean aDefault) {
// isDefault = aDefault;
// }
//
// public boolean isActive() {
// return active;
// }
//
// public void setActive(boolean active) {
// this.active = active;
// }
//
// public long getMemberCount() {
// return memberCount;
// }
//
// public void setMemberCount(long memberCount) {
// this.memberCount = memberCount;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import com.domo.sdk.groups.model.UpdateGroupRequest;
import org.junit.Test;
package com.domo.sdk.groups;
public class UpdateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group | Group group = CreateExample.createGroup(gClient); |
domoinc/domo-java-sdk | domo-java-sdk-all/src/test/java/com/domo/sdk/groups/UpdateExample.java | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/UpdateGroupRequest.java
// public class UpdateGroupRequest {
//
// private String name;
// private boolean active = true;
//
// @SerializedName("default")
// private boolean isDefault;
// private long memberCount;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public boolean isDefault() {
// return isDefault;
// }
//
// public void setDefault(boolean aDefault) {
// isDefault = aDefault;
// }
//
// public boolean isActive() {
// return active;
// }
//
// public void setActive(boolean active) {
// this.active = active;
// }
//
// public long getMemberCount() {
// return memberCount;
// }
//
// public void setMemberCount(long memberCount) {
// this.memberCount = memberCount;
// }
// }
| import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import com.domo.sdk.groups.model.UpdateGroupRequest;
import org.junit.Test; | package com.domo.sdk.groups;
public class UpdateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group
Group group = CreateExample.createGroup(gClient);
//Update group | // Path: domo-java-sdk-all/src/test/java/com/domo/sdk/ExampleBase.java
// public class ExampleBase {
//
// protected DomoClient client;
//
// @Before
// public void setup() {
// Config config = Config.with()
// .clientId("MY_CLIENT_ID")
// .clientSecret("MY_CLIENT_SECRET")
// .apiHost("api.domo.com")
// .useHttps(true)
// .scope(USER, DATA, WORKFLOW)
// .httpLoggingLevel(HttpLoggingInterceptor.Level.BODY)
// .build();
//
// client = DomoClient.create(config);
// }
//
//
// public static String convertStreamToString(java.io.InputStream is) {
// java.util.Scanner s = new java.util.Scanner(is).useDelimiter("\\A");
// return s.hasNext() ? s.next() : "";
// }
//
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/Group.java
// public class Group {
//
// private Long id;
// private String name;
// private boolean isActive;
// private Long creatorId;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public Long getId() {
// return id;
// }
//
// public void setId(Long id) {
// this.id = id;
// }
//
// public void setId(String id) {
// this.id = Long.parseLong(id);
// }
//
//
// public boolean isActive() {
// return isActive;
// }
//
// public void setActive(boolean active) {
// isActive = active;
// }
//
// public Long getCreatorId() {
// return creatorId;
// }
//
// public void setCreatorId(Long creatorId) {
// this.creatorId = creatorId;
// }
//
// @Override
// public String toString() {
// return "Group{" +
// "id=" + id +
// ", name='" + name + '\'' +
// ", isActive=" + isActive +
// ", creatorId=" + creatorId +
// '}';
// }
// }
//
// Path: domo-java-sdk-all/src/main/java/com/domo/sdk/groups/model/UpdateGroupRequest.java
// public class UpdateGroupRequest {
//
// private String name;
// private boolean active = true;
//
// @SerializedName("default")
// private boolean isDefault;
// private long memberCount;
//
// public String getName() {
// return name;
// }
//
// public void setName(String name) {
// this.name = name;
// }
//
// public boolean isDefault() {
// return isDefault;
// }
//
// public void setDefault(boolean aDefault) {
// isDefault = aDefault;
// }
//
// public boolean isActive() {
// return active;
// }
//
// public void setActive(boolean active) {
// this.active = active;
// }
//
// public long getMemberCount() {
// return memberCount;
// }
//
// public void setMemberCount(long memberCount) {
// this.memberCount = memberCount;
// }
// }
// Path: domo-java-sdk-all/src/test/java/com/domo/sdk/groups/UpdateExample.java
import com.domo.sdk.ExampleBase;
import com.domo.sdk.groups.model.Group;
import com.domo.sdk.groups.model.UpdateGroupRequest;
import org.junit.Test;
package com.domo.sdk.groups;
public class UpdateExample extends ExampleBase {
@Test
public void groupClient_smokeTest() {
GroupClient gClient = client.groupClient();
//Create group
Group group = CreateExample.createGroup(gClient);
//Update group | UpdateGroupRequest ugroup = new UpdateGroupRequest(); |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/indexer/OdpIndexer.java | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
| import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; | *
* @param indexPath
* @param filename
*/
public void createIndex(String indexPath, String filename) {
try {
FileInputStream fis = new FileInputStream(filename);
OdpHandler handler = new OdpHandler(indexPath, removeStopWords, doStemming);
saxParser.parse(fis, handler);
handler.finish();
} catch (SAXException | IOException ex) {
Logger.getLogger(OdpIndexer.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String[] args) throws IOException {
OdpIndexer indexer = new OdpIndexer(false, false);
indexer.createIndex("../lucene-ODP-index", "./data/ODP-Crawled-Data-Level-4.xml");
}
}
class OdpHandler extends DefaultHandler {
private IndexWriter writer;
private final FieldType _contentFieldType;
private final StringBuilder content;
private boolean isContent;
private int pagesCompleted;
private String currentTopicName;
private String currentURL; | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
// Path: source_code/src/edu/virginia/cs/indexer/OdpIndexer.java
import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
*
* @param indexPath
* @param filename
*/
public void createIndex(String indexPath, String filename) {
try {
FileInputStream fis = new FileInputStream(filename);
OdpHandler handler = new OdpHandler(indexPath, removeStopWords, doStemming);
saxParser.parse(fis, handler);
handler.finish();
} catch (SAXException | IOException ex) {
Logger.getLogger(OdpIndexer.class.getName()).log(Level.SEVERE, null, ex);
}
}
public static void main(String[] args) throws IOException {
OdpIndexer indexer = new OdpIndexer(false, false);
indexer.createIndex("../lucene-ODP-index", "./data/ODP-Crawled-Data-Level-4.xml");
}
}
class OdpHandler extends DefaultHandler {
private IndexWriter writer;
private final FieldType _contentFieldType;
private final StringBuilder content;
private boolean isContent;
private int pagesCompleted;
private String currentTopicName;
private String currentURL; | private final TextTokenizer tokenizer; |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/indexer/OdpIndexer.java | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
| import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; | private boolean isContent;
private int pagesCompleted;
private String currentTopicName;
private String currentURL;
private final TextTokenizer tokenizer;
private final TextTokenizer globalTokenizer;
public OdpHandler(String indexPath, boolean removeStopWords, boolean doStemming) throws IOException {
content = new StringBuilder();
_contentFieldType = new FieldType();
_contentFieldType.setIndexed(true);
_contentFieldType.setStored(true);
pagesCompleted = 0;
setupIndex(indexPath);
tokenizer = new TextTokenizer(removeStopWords, doStemming);
globalTokenizer = new TextTokenizer(true, true);
}
public void finish() throws IOException {
writer.close();
}
/**
* Creates the initial index files on disk.
*
* @param indexPath
* @return
* @throws IOException
*/
private void setupIndex(String indexPath) throws IOException { | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
// Path: source_code/src/edu/virginia/cs/indexer/OdpIndexer.java
import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
private boolean isContent;
private int pagesCompleted;
private String currentTopicName;
private String currentURL;
private final TextTokenizer tokenizer;
private final TextTokenizer globalTokenizer;
public OdpHandler(String indexPath, boolean removeStopWords, boolean doStemming) throws IOException {
content = new StringBuilder();
_contentFieldType = new FieldType();
_contentFieldType.setIndexed(true);
_contentFieldType.setStored(true);
pagesCompleted = 0;
setupIndex(indexPath);
tokenizer = new TextTokenizer(removeStopWords, doStemming);
globalTokenizer = new TextTokenizer(true, true);
}
public void finish() throws IOException {
writer.close();
}
/**
* Creates the initial index files on disk.
*
* @param indexPath
* @return
* @throws IOException
*/
private void setupIndex(String indexPath) throws IOException { | Analyzer analyzer = new SpecialAnalyzer(true, true); |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/config/StaticData.java | // Path: source_code/src/edu/virginia/cs/io/FileIO.java
// public class FileIO {
//
// public static void appnedToFile(String filename, String line) throws IOException {
// File file = new File(filename);
// FileWriter fileWritter = new FileWriter(file.getAbsolutePath(), true);
// BufferedWriter bw = new BufferedWriter(fileWritter);
// bw.write(line + "\n");
// bw.close();
// }
//
// public static void appnedToFile(String filename, List<Map.Entry<String, Integer>> param, int choice) throws IOException {
// FileWriter fw = new FileWriter(filename);
// if (choice == 1) {
// for (Map.Entry<String, Integer> entry : param) {
// fw.write(entry.getKey() + "\n");
// }
// } else {
// for (Map.Entry<String, Integer> entry : param) {
// fw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// }
// fw.close();
// }
//
// public static void storeInFile(String filename, List<Map.Entry<String, Double>> param) throws IOException {
// File file = new File(filename);
// FileWriter fw = new FileWriter(file.getAbsolutePath());
// BufferedWriter bw = new BufferedWriter(fw);
// for (Map.Entry<String, Double> entry : param) {
// bw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// bw.close();
// }
//
// public static void storeInFile(String filename, HashMap<String, ArrayList<String>> param) throws IOException {
// FileWriter fw = new FileWriter(filename);
// for (Map.Entry<String, ArrayList<String>> entry : param.entrySet()) {
// String finalStr = "";
// for (String str : entry.getValue()) {
// finalStr += str + " ";
// }
// fw.write(entry.getKey() + " " + finalStr + "\n");
// }
// fw.close();
// }
//
// public static void storeHashMapInFile(String filename, HashMap<String, Float> param) throws IOException {
// FileWriter fw = new FileWriter(filename);
// for (Map.Entry<String, Float> entry : param.entrySet()) {
// fw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// fw.close();
// }
//
// public static String LoadFile(String filename) {
// try {
// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// StringBuilder builder = new StringBuilder(1024);
// String line;
//
// while ((line = reader.readLine()) != null) {
// line = line.trim();
// if (!line.isEmpty()) {
// builder.append(line);
// builder.append("\n");
// }
// }
// reader.close();
// return builder.toString();
// } catch (IOException e) {
// System.err.format("[Error]Failed to open file %s!", filename);
// return null;
// }
// }
//
// public static ArrayList<String> LoadFile(String filename, int numberOfLines) {
// try {
// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// ArrayList<String> lines = new ArrayList<>();
// String line;
// int counter = 0;
// while ((line = reader.readLine()) != null) {
// if (counter == numberOfLines) {
// break;
// }
// line = line.trim();
// if (line.isEmpty()) {
// continue;
// }
// lines.add(line);
// counter++;
// }
// reader.close();
// return lines;
// } catch (IOException e) {
// System.err.format("[Error]Failed to open file %s!", filename);
// return null;
// }
// }
// }
| import java.util.ArrayList;
import java.util.HashMap;
import edu.virginia.cs.io.FileIO; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.config;
/**
*
* @author wua4nw
*/
public class StaticData {
public static HashMap<String, Double> SmoothingReference;
public static HashMap<String, Double> IDFRecord;
/**
* Method to load the reference model which is generated previously.
*
* @param filename
*/
public static void loadRefModel(String filename) {
SmoothingReference = new HashMap<>(); | // Path: source_code/src/edu/virginia/cs/io/FileIO.java
// public class FileIO {
//
// public static void appnedToFile(String filename, String line) throws IOException {
// File file = new File(filename);
// FileWriter fileWritter = new FileWriter(file.getAbsolutePath(), true);
// BufferedWriter bw = new BufferedWriter(fileWritter);
// bw.write(line + "\n");
// bw.close();
// }
//
// public static void appnedToFile(String filename, List<Map.Entry<String, Integer>> param, int choice) throws IOException {
// FileWriter fw = new FileWriter(filename);
// if (choice == 1) {
// for (Map.Entry<String, Integer> entry : param) {
// fw.write(entry.getKey() + "\n");
// }
// } else {
// for (Map.Entry<String, Integer> entry : param) {
// fw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// }
// fw.close();
// }
//
// public static void storeInFile(String filename, List<Map.Entry<String, Double>> param) throws IOException {
// File file = new File(filename);
// FileWriter fw = new FileWriter(file.getAbsolutePath());
// BufferedWriter bw = new BufferedWriter(fw);
// for (Map.Entry<String, Double> entry : param) {
// bw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// bw.close();
// }
//
// public static void storeInFile(String filename, HashMap<String, ArrayList<String>> param) throws IOException {
// FileWriter fw = new FileWriter(filename);
// for (Map.Entry<String, ArrayList<String>> entry : param.entrySet()) {
// String finalStr = "";
// for (String str : entry.getValue()) {
// finalStr += str + " ";
// }
// fw.write(entry.getKey() + " " + finalStr + "\n");
// }
// fw.close();
// }
//
// public static void storeHashMapInFile(String filename, HashMap<String, Float> param) throws IOException {
// FileWriter fw = new FileWriter(filename);
// for (Map.Entry<String, Float> entry : param.entrySet()) {
// fw.write(entry.getKey() + " " + entry.getValue() + "\n");
// }
// fw.close();
// }
//
// public static String LoadFile(String filename) {
// try {
// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// StringBuilder builder = new StringBuilder(1024);
// String line;
//
// while ((line = reader.readLine()) != null) {
// line = line.trim();
// if (!line.isEmpty()) {
// builder.append(line);
// builder.append("\n");
// }
// }
// reader.close();
// return builder.toString();
// } catch (IOException e) {
// System.err.format("[Error]Failed to open file %s!", filename);
// return null;
// }
// }
//
// public static ArrayList<String> LoadFile(String filename, int numberOfLines) {
// try {
// BufferedReader reader = new BufferedReader(new InputStreamReader(new FileInputStream(filename), "UTF-8"));
// ArrayList<String> lines = new ArrayList<>();
// String line;
// int counter = 0;
// while ((line = reader.readLine()) != null) {
// if (counter == numberOfLines) {
// break;
// }
// line = line.trim();
// if (line.isEmpty()) {
// continue;
// }
// lines.add(line);
// counter++;
// }
// reader.close();
// return lines;
// } catch (IOException e) {
// System.err.format("[Error]Failed to open file %s!", filename);
// return null;
// }
// }
// }
// Path: source_code/src/edu/virginia/cs/config/StaticData.java
import java.util.ArrayList;
import java.util.HashMap;
import edu.virginia.cs.io.FileIO;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.config;
/**
*
* @author wua4nw
*/
public class StaticData {
public static HashMap<String, Double> SmoothingReference;
public static HashMap<String, Double> IDFRecord;
/**
* Method to load the reference model which is generated previously.
*
* @param filename
*/
public static void loadRefModel(String filename) {
SmoothingReference = new HashMap<>(); | ArrayList<String> lines = FileIO.LoadFile(filename, -1); |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/utility/Converter.java | // Path: source_code/src/edu/virginia/cs/object/ResultDoc.java
// public class ResultDoc {
//
// private final int _id;
// private String _title = "[no title]";
// private String _content = "[no content]";
// private String _modifiedContent = "[no modified content]";
// private String _docUrl = "[no url]";
// private boolean _isClicked = false;
// private String _topic = "[no topic]";
// private float _BM25Score;
// private float _personalizationScore;
//
// public ResultDoc() {
// _id = -1;
// }
//
// public float getBM25Score() {
// return _BM25Score;
// }
//
// public void setBM25Score(float _BM25Score) {
// this._BM25Score = _BM25Score;
// }
//
// public float getPersonalizationScore() {
// return _personalizationScore;
// }
//
// public void setPersonalizationScore(float _personalizationScore) {
// this._personalizationScore = _personalizationScore;
// }
//
// public ResultDoc(int id) {
// _id = id;
// }
//
// public int getId() {
// return _id;
// }
//
// public String getTitle() {
// return _title;
// }
//
// public ResultDoc setTitle(String nTitle) {
// _title = nTitle;
// return this;
// }
//
// public String getContent() {
// return _content;
// }
//
// public String getUrl() {
// return _docUrl;
// }
//
// public ResultDoc setContent(String nContent) {
// _content = nContent;
// return this;
// }
//
// public String getModifiedContent() {
// return _modifiedContent;
// }
//
// public void setModifiedContent(String _modifiedContent) {
// this._modifiedContent = _modifiedContent;
// }
//
// public ResultDoc setUrl(String nContent) {
// _docUrl = nContent;
// return this;
// }
//
// public ResultDoc setClicked() {
// _isClicked = true;
// return this;
// }
//
// public boolean isClicked() {
// return _isClicked;
// }
//
// public String getTopic() {
// return _topic;
// }
//
// public void setTopic(String _topic) {
// this._topic = _topic;
// }
//
// }
| import edu.virginia.cs.object.ResultDoc;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.lucene.document.Document;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.ScoreDoc; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.utility;
/**
*
* @author wua4nw
*/
public class Converter {
public static Date convertStringToDate(String time) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = formatter.parse(time);
} catch (ParseException ex) {
Logger.getLogger(Converter.class.getName()).log(Level.SEVERE, null, ex);
}
return date;
}
public static String convertStringToDate(Date time) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = formatter.format(time);
return date;
}
| // Path: source_code/src/edu/virginia/cs/object/ResultDoc.java
// public class ResultDoc {
//
// private final int _id;
// private String _title = "[no title]";
// private String _content = "[no content]";
// private String _modifiedContent = "[no modified content]";
// private String _docUrl = "[no url]";
// private boolean _isClicked = false;
// private String _topic = "[no topic]";
// private float _BM25Score;
// private float _personalizationScore;
//
// public ResultDoc() {
// _id = -1;
// }
//
// public float getBM25Score() {
// return _BM25Score;
// }
//
// public void setBM25Score(float _BM25Score) {
// this._BM25Score = _BM25Score;
// }
//
// public float getPersonalizationScore() {
// return _personalizationScore;
// }
//
// public void setPersonalizationScore(float _personalizationScore) {
// this._personalizationScore = _personalizationScore;
// }
//
// public ResultDoc(int id) {
// _id = id;
// }
//
// public int getId() {
// return _id;
// }
//
// public String getTitle() {
// return _title;
// }
//
// public ResultDoc setTitle(String nTitle) {
// _title = nTitle;
// return this;
// }
//
// public String getContent() {
// return _content;
// }
//
// public String getUrl() {
// return _docUrl;
// }
//
// public ResultDoc setContent(String nContent) {
// _content = nContent;
// return this;
// }
//
// public String getModifiedContent() {
// return _modifiedContent;
// }
//
// public void setModifiedContent(String _modifiedContent) {
// this._modifiedContent = _modifiedContent;
// }
//
// public ResultDoc setUrl(String nContent) {
// _docUrl = nContent;
// return this;
// }
//
// public ResultDoc setClicked() {
// _isClicked = true;
// return this;
// }
//
// public boolean isClicked() {
// return _isClicked;
// }
//
// public String getTopic() {
// return _topic;
// }
//
// public void setTopic(String _topic) {
// this._topic = _topic;
// }
//
// }
// Path: source_code/src/edu/virginia/cs/utility/Converter.java
import edu.virginia.cs.object.ResultDoc;
import java.io.IOException;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.logging.Level;
import java.util.logging.Logger;
import org.apache.lucene.document.Document;
import org.apache.lucene.search.IndexSearcher;
import org.apache.lucene.search.ScoreDoc;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.utility;
/**
*
* @author wua4nw
*/
public class Converter {
public static Date convertStringToDate(String time) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
Date date = null;
try {
date = formatter.parse(time);
} catch (ParseException ex) {
Logger.getLogger(Converter.class.getName()).log(Level.SEVERE, null, ex);
}
return date;
}
public static String convertStringToDate(Date time) {
SimpleDateFormat formatter = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
String date = formatter.format(time);
return date;
}
| public static ResultDoc convertToResultDoc(ScoreDoc scoreDoc, IndexSearcher indexSearcher, String field) { |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/indexer/AolIndexer.java | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
| import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; | class AolHandler extends DefaultHandler {
private IndexWriter writer;
private final FieldType _contentFieldType;
private final StringBuilder content;
private String currentURL;
private boolean isContent;
private int pagesCompleted;
public AolHandler(String indexPath) throws IOException {
content = new StringBuilder();
_contentFieldType = new FieldType();
_contentFieldType.setIndexed(true);
_contentFieldType.setStored(true);
pagesCompleted = 0;
setupIndex(indexPath);
}
public void finish() throws IOException {
writer.close();
}
/**
* Creates the initial index files on disk.
*
* @param indexPath
* @return
* @throws IOException
*/
private void setupIndex(String indexPath) throws IOException { | // Path: source_code/src/edu/virginia/cs/utility/SpecialAnalyzer.java
// public class SpecialAnalyzer extends Analyzer {
//
// private final boolean removeStopWords;
// private final boolean doStemming;
//
// public SpecialAnalyzer(boolean stopWordRemoval, boolean stemming) {
// removeStopWords = stopWordRemoval;
// doStemming = stemming;
// }
//
// @Override
// protected TokenStreamComponents createComponents(String fieldName,
// Reader reader) {
// Tokenizer source = new StandardTokenizer(Version.LUCENE_46, reader);
// TokenStream filter = new StandardFilter(Version.LUCENE_46, source);
// filter = new LowerCaseFilter(Version.LUCENE_46, filter);
// filter = new LengthFilter(Version.LUCENE_46, filter, 2, 35);
// if (doStemming) {
// filter = new PorterStemFilter(filter);
// }
// if (removeStopWords) {
// filter = new StopFilter(Version.LUCENE_46, filter,
// StopFilter.makeStopSet(Version.LUCENE_46, StopWords.STOPWORDS));
// }
// return new TokenStreamComponents(source, filter);
// }
// }
//
// Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
// Path: source_code/src/edu/virginia/cs/indexer/AolIndexer.java
import edu.virginia.cs.utility.SpecialAnalyzer;
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileInputStream;
import java.io.IOException;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.apache.lucene.analysis.Analyzer;
import org.apache.lucene.document.Document;
import org.apache.lucene.document.Field;
import org.apache.lucene.document.Field.Store;
import org.apache.lucene.document.FieldType;
import org.apache.lucene.document.StringField;
import org.apache.lucene.index.IndexWriter;
import org.apache.lucene.index.IndexWriterConfig;
import org.apache.lucene.index.IndexWriterConfig.OpenMode;
import org.apache.lucene.store.FSDirectory;
import org.apache.lucene.util.Version;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
class AolHandler extends DefaultHandler {
private IndexWriter writer;
private final FieldType _contentFieldType;
private final StringBuilder content;
private String currentURL;
private boolean isContent;
private int pagesCompleted;
public AolHandler(String indexPath) throws IOException {
content = new StringBuilder();
_contentFieldType = new FieldType();
_contentFieldType.setIndexed(true);
_contentFieldType.setStored(true);
pagesCompleted = 0;
setupIndex(indexPath);
}
public void finish() throws IOException {
writer.close();
}
/**
* Creates the initial index files on disk.
*
* @param indexPath
* @return
* @throws IOException
*/
private void setupIndex(String indexPath) throws IOException { | Analyzer analyzer = new SpecialAnalyzer(true, true); |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/preprocessing/DMOZDictionary.java | // Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
| import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.preprocessing;
/**
*
* @author Wasi
*/
public class DMOZDictionary {
private static SAXParserFactory factory;
private static SAXParser saxParser;
public static void main(String[] args) {
try {
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
readFile("./data/ODP-Crawled-Data-Level-4.xml");
} catch (ParserConfigurationException | SAXException ex) {
Logger.getLogger(DMOZDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static void readFile(String filename) {
try {
File inputFile = new File(filename);
OdpHandler dataHandler = new OdpHandler("./data/ODP-Dictionary");
saxParser.parse(inputFile, dataHandler);
} catch (SAXException | IOException ex) {
Logger.getLogger(DMOZDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
class OdpHandler extends DefaultHandler {
private FileWriter fwriter;
private StringBuilder buffer;
private boolean isContent;
private int docCount;
private int tokenCount;
private final HashMap<String, Integer> Dictionary; | // Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
// Path: source_code/src/edu/virginia/cs/preprocessing/DMOZDictionary.java
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.preprocessing;
/**
*
* @author Wasi
*/
public class DMOZDictionary {
private static SAXParserFactory factory;
private static SAXParser saxParser;
public static void main(String[] args) {
try {
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
readFile("./data/ODP-Crawled-Data-Level-4.xml");
} catch (ParserConfigurationException | SAXException ex) {
Logger.getLogger(DMOZDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static void readFile(String filename) {
try {
File inputFile = new File(filename);
OdpHandler dataHandler = new OdpHandler("./data/ODP-Dictionary");
saxParser.parse(inputFile, dataHandler);
} catch (SAXException | IOException ex) {
Logger.getLogger(DMOZDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
class OdpHandler extends DefaultHandler {
private FileWriter fwriter;
private StringBuilder buffer;
private boolean isContent;
private int docCount;
private int tokenCount;
private final HashMap<String, Integer> Dictionary; | private final TextTokenizer tokenizer; |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/engine/SearchQuery.java | // Path: source_code/src/edu/virginia/cs/extra/Constants.java
// public class Constants {
//
// public final static int DEFAULT_NUM_RESULTS = 100;
// public final static String DEFAULT_FIELD = "content";
// public final static int NUM_FRAGMENTS = 4;
// }
| import edu.virginia.cs.extra.Constants;
import java.util.ArrayList;
import java.util.Objects; | public String queryText() {
return queryText;
}
public SearchQuery fields(String field) {
fields = new ArrayList<>();
fields.add(field);
return this;
}
public int numResults() {
return numResults;
}
public SearchQuery numResults(int numResults) {
this.numResults = numResults;
return this;
}
public int fromDoc() {
return from;
}
public SearchQuery fromDoc(int fromDoc) {
this.from = fromDoc;
return this;
}
public SearchQuery(String queryText, ArrayList<String> fields) {
this.queryText = queryText; | // Path: source_code/src/edu/virginia/cs/extra/Constants.java
// public class Constants {
//
// public final static int DEFAULT_NUM_RESULTS = 100;
// public final static String DEFAULT_FIELD = "content";
// public final static int NUM_FRAGMENTS = 4;
// }
// Path: source_code/src/edu/virginia/cs/engine/SearchQuery.java
import edu.virginia.cs.extra.Constants;
import java.util.ArrayList;
import java.util.Objects;
public String queryText() {
return queryText;
}
public SearchQuery fields(String field) {
fields = new ArrayList<>();
fields.add(field);
return this;
}
public int numResults() {
return numResults;
}
public SearchQuery numResults(int numResults) {
this.numResults = numResults;
return this;
}
public int fromDoc() {
return from;
}
public SearchQuery fromDoc(int fromDoc) {
this.from = fromDoc;
return this;
}
public SearchQuery(String queryText, ArrayList<String> fields) {
this.queryText = queryText; | this.numResults = Constants.DEFAULT_NUM_RESULTS; |
wasiahmad/intent_aware_privacy_protection_in_pws | source_code/src/edu/virginia/cs/preprocessing/AOLDictionary.java | // Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
| import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler; | /*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.preprocessing;
/**
*
* @author Wasi
*/
public class AOLDictionary {
private static SAXParserFactory factory;
private static SAXParser saxParser;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
readFile("./data/AolCrawledData.xml");
} catch (ParserConfigurationException | SAXException ex) {
Logger.getLogger(AOLDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static void readFile(String filename) {
try {
File inputFile = new File(filename);
AolHandler dataHandler = new AolHandler("./data/AOL-Dictionary-TF");
// AolHandler dataHandler = new AolHandler("./data/AOL-Dictionary");
saxParser.parse(inputFile, dataHandler);
} catch (SAXException | IOException ex) {
Logger.getLogger(AOLDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
class AolHandler extends DefaultHandler {
private FileWriter fwriter;
private StringBuilder buffer;
private boolean isContent;
private int pageCount;
private int tokenCount;
private final HashMap<String, Integer> Dictionary; | // Path: source_code/src/edu/virginia/cs/utility/TextTokenizer.java
// public class TextTokenizer {
//
// private final SpecialAnalyzer analyzer;
//
// public TextTokenizer(boolean removeStopWords, boolean doStemming) {
// analyzer = new SpecialAnalyzer(removeStopWords, doStemming);
// }
//
// /**
// * Method that generates list of tokens from the parameter string.
// *
// * @param string
// * @return list of tokens generated
// */
// public List<String> TokenizeText(String string) {
// List<String> result = new ArrayList<>();
// try {
// TokenStream stream = analyzer.tokenStream(null, new StringReader(string));
// stream.reset();
// while (stream.incrementToken()) {
// result.add(stream.getAttribute(CharTermAttribute.class
// ).toString());
// }
// stream.end();
// stream.close();
// } catch (IOException e) {
// throw new RuntimeException(e);
// }
// return result;
// }
// }
// Path: source_code/src/edu/virginia/cs/preprocessing/AOLDictionary.java
import edu.virginia.cs.utility.TextTokenizer;
import java.io.File;
import java.io.FileWriter;
import java.io.IOException;
import java.util.HashMap;
import java.util.HashSet;
import java.util.List;
import java.util.Map;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.parsers.SAXParser;
import javax.xml.parsers.SAXParserFactory;
import org.xml.sax.Attributes;
import org.xml.sax.SAXException;
import org.xml.sax.helpers.DefaultHandler;
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package edu.virginia.cs.preprocessing;
/**
*
* @author Wasi
*/
public class AOLDictionary {
private static SAXParserFactory factory;
private static SAXParser saxParser;
/**
* @param args the command line arguments
*/
public static void main(String[] args) {
// TODO code application logic here
try {
factory = SAXParserFactory.newInstance();
saxParser = factory.newSAXParser();
readFile("./data/AolCrawledData.xml");
} catch (ParserConfigurationException | SAXException ex) {
Logger.getLogger(AOLDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
private static void readFile(String filename) {
try {
File inputFile = new File(filename);
AolHandler dataHandler = new AolHandler("./data/AOL-Dictionary-TF");
// AolHandler dataHandler = new AolHandler("./data/AOL-Dictionary");
saxParser.parse(inputFile, dataHandler);
} catch (SAXException | IOException ex) {
Logger.getLogger(AOLDictionary.class.getName()).log(Level.SEVERE, null, ex);
}
}
}
class AolHandler extends DefaultHandler {
private FileWriter fwriter;
private StringBuilder buffer;
private boolean isContent;
private int pageCount;
private int tokenCount;
private final HashMap<String, Integer> Dictionary; | private final TextTokenizer tokenizer; |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/api/mod/ModCandidate.java | // Path: src/main/java/com/openmodloader/api/mod/config/IModConfig.java
// public interface IModConfig {
// default void apply(IModConfigurator configurator) {
// configurator.configure(this);
// }
//
// void addEventConfig(IEventConfig config);
//
// void addRegistrationConfig(IRegistrationConfig config);
//
// Collection<IEventConfig> getEventConfigs();
//
// Collection<IRegistrationConfig> getRegistrationConfigs();
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/IModConfigurator.java
// public interface IModConfigurator {
// default IModConfig initConfig() {
// return new SimpleModConfig();
// }
//
// void configure(IModConfig config);
// }
| import com.openmodloader.api.mod.config.IModConfig;
import com.openmodloader.api.mod.config.IModConfigurator; | package com.openmodloader.api.mod;
public class ModCandidate {
private final ModMetadata metadata; | // Path: src/main/java/com/openmodloader/api/mod/config/IModConfig.java
// public interface IModConfig {
// default void apply(IModConfigurator configurator) {
// configurator.configure(this);
// }
//
// void addEventConfig(IEventConfig config);
//
// void addRegistrationConfig(IRegistrationConfig config);
//
// Collection<IEventConfig> getEventConfigs();
//
// Collection<IRegistrationConfig> getRegistrationConfigs();
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/IModConfigurator.java
// public interface IModConfigurator {
// default IModConfig initConfig() {
// return new SimpleModConfig();
// }
//
// void configure(IModConfig config);
// }
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
import com.openmodloader.api.mod.config.IModConfig;
import com.openmodloader.api.mod.config.IModConfigurator;
package com.openmodloader.api.mod;
public class ModCandidate {
private final ModMetadata metadata; | private final IModConfigurator configurator; |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/api/mod/ModCandidate.java | // Path: src/main/java/com/openmodloader/api/mod/config/IModConfig.java
// public interface IModConfig {
// default void apply(IModConfigurator configurator) {
// configurator.configure(this);
// }
//
// void addEventConfig(IEventConfig config);
//
// void addRegistrationConfig(IRegistrationConfig config);
//
// Collection<IEventConfig> getEventConfigs();
//
// Collection<IRegistrationConfig> getRegistrationConfigs();
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/IModConfigurator.java
// public interface IModConfigurator {
// default IModConfig initConfig() {
// return new SimpleModConfig();
// }
//
// void configure(IModConfig config);
// }
| import com.openmodloader.api.mod.config.IModConfig;
import com.openmodloader.api.mod.config.IModConfigurator; | package com.openmodloader.api.mod;
public class ModCandidate {
private final ModMetadata metadata;
private final IModConfigurator configurator;
private boolean global;
public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
this.metadata = metadata;
this.configurator = configurator;
}
public ModCandidate global() {
global = true;
return this;
}
public boolean isGlobal() {
return global;
}
public Mod construct() { | // Path: src/main/java/com/openmodloader/api/mod/config/IModConfig.java
// public interface IModConfig {
// default void apply(IModConfigurator configurator) {
// configurator.configure(this);
// }
//
// void addEventConfig(IEventConfig config);
//
// void addRegistrationConfig(IRegistrationConfig config);
//
// Collection<IEventConfig> getEventConfigs();
//
// Collection<IRegistrationConfig> getRegistrationConfigs();
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/IModConfigurator.java
// public interface IModConfigurator {
// default IModConfig initConfig() {
// return new SimpleModConfig();
// }
//
// void configure(IModConfig config);
// }
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
import com.openmodloader.api.mod.config.IModConfig;
import com.openmodloader.api.mod.config.IModConfigurator;
package com.openmodloader.api.mod;
public class ModCandidate {
private final ModMetadata metadata;
private final IModConfigurator configurator;
private boolean global;
public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
this.metadata = metadata;
this.configurator = configurator;
}
public ModCandidate global() {
global = true;
return this;
}
public boolean isGlobal() {
return global;
}
public Mod construct() { | IModConfig config = configurator.initConfig(); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/network/mixin/SPacketHandler.java | // Path: src/main/java/com/openmodloader/network/IPacketData.java
// public interface IPacketData {
// Identifier getChannel();
//
// PacketByteBuf getData();
// }
| import com.openmodloader.network.IPacketData;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.network.handler.NetworkGameHandlerServer;
import net.minecraft.network.packet.server.SPacketCustomPayload; | package com.openmodloader.network.mixin;
@Mixin(value = NetworkGameHandlerServer.class)
public abstract class SPacketHandler {
@Rewrite(behavior = Rewrite.Behavior.END)
public void onCustomPayload(SPacketCustomPayload packet) { | // Path: src/main/java/com/openmodloader/network/IPacketData.java
// public interface IPacketData {
// Identifier getChannel();
//
// PacketByteBuf getData();
// }
// Path: src/main/java/com/openmodloader/network/mixin/SPacketHandler.java
import com.openmodloader.network.IPacketData;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.network.handler.NetworkGameHandlerServer;
import net.minecraft.network.packet.server.SPacketCustomPayload;
package com.openmodloader.network.mixin;
@Mixin(value = NetworkGameHandlerServer.class)
public abstract class SPacketHandler {
@Rewrite(behavior = Rewrite.Behavior.END)
public void onCustomPayload(SPacketCustomPayload packet) { | IPacketData packetData = (IPacketData) packet; |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/BuiltinModReporter.java | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
| import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator; | package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) { | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
// Path: src/main/java/com/openmodloader/loader/BuiltinModReporter.java
import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator;
package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) { | ModMetadata vanillaMetadata = new ModMetadata("minecraft", Version.valueOf("1.14.0+18w46a")); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/BuiltinModReporter.java | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
| import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator; | package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) {
ModMetadata vanillaMetadata = new ModMetadata("minecraft", Version.valueOf("1.14.0+18w46a")); | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
// Path: src/main/java/com/openmodloader/loader/BuiltinModReporter.java
import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator;
package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) {
ModMetadata vanillaMetadata = new ModMetadata("minecraft", Version.valueOf("1.14.0+18w46a")); | collector.report(new ModCandidate(vanillaMetadata, new VoidModConfigurator()).global()); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/BuiltinModReporter.java | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
| import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator; | package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) {
ModMetadata vanillaMetadata = new ModMetadata("minecraft", Version.valueOf("1.14.0+18w46a")); | // Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModCandidate.java
// public class ModCandidate {
// private final ModMetadata metadata;
// private final IModConfigurator configurator;
// private boolean global;
//
// public ModCandidate(ModMetadata metadata, IModConfigurator configurator) {
// this.metadata = metadata;
// this.configurator = configurator;
// }
//
// public ModCandidate global() {
// global = true;
// return this;
// }
//
// public boolean isGlobal() {
// return global;
// }
//
// public Mod construct() {
// IModConfig config = configurator.initConfig();
// configurator.configure(config);
//
// return new Mod(metadata, config, global);
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/ModMetadata.java
// public class ModMetadata {
// private final String id;
// private final Version version;
//
// public ModMetadata(String id, Version version) {
// this.id = id;
// this.version = version;
// }
//
// public String getId() {
// return id;
// }
//
// public Version getVersion() {
// return version;
// }
//
// @Override
// public boolean equals(Object obj) {
// if (this == obj) return true;
// if (obj == null || getClass() != obj.getClass()) return false;
//
// ModMetadata metadata = (ModMetadata) obj;
// return metadata.id.equals(id);
// }
//
// @Override
// public int hashCode() {
// return id.hashCode();
// }
// }
//
// Path: src/main/java/com/openmodloader/api/mod/config/VoidModConfigurator.java
// public class VoidModConfigurator implements IModConfigurator {
// @Override
// public void configure(IModConfig config) {
// }
// }
// Path: src/main/java/com/openmodloader/loader/BuiltinModReporter.java
import com.github.zafarkhaja.semver.Version;
import com.openmodloader.api.loader.IModReporter;
import com.openmodloader.api.mod.ModCandidate;
import com.openmodloader.api.mod.ModMetadata;
import com.openmodloader.api.mod.config.VoidModConfigurator;
package com.openmodloader.loader;
public class BuiltinModReporter implements IModReporter {
@Override
public void apply(ModReportCollector collector, ModConstructor constructor) {
ModMetadata vanillaMetadata = new ModMetadata("minecraft", Version.valueOf("1.14.0+18w46a")); | collector.report(new ModCandidate(vanillaMetadata, new VoidModConfigurator()).global()); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/client/ClientGameContext.java | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
| import com.openmodloader.api.IGameContext;
import net.fabricmc.api.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import javax.annotation.Nullable;
import java.io.File; | package com.openmodloader.loader.client;
public class ClientGameContext implements IGameContext {
@Override
public File getRunDirectory() {
return Minecraft.getInstance().runDirectory;
}
@Nullable
@Override
public MinecraftServer getServer() {
return Minecraft.getInstance().getServer();
}
@Override | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
// Path: src/main/java/com/openmodloader/loader/client/ClientGameContext.java
import com.openmodloader.api.IGameContext;
import net.fabricmc.api.Side;
import net.minecraft.client.Minecraft;
import net.minecraft.server.MinecraftServer;
import javax.annotation.Nullable;
import java.io.File;
package com.openmodloader.loader.client;
public class ClientGameContext implements IGameContext {
@Override
public File getRunDirectory() {
return Minecraft.getInstance().runDirectory;
}
@Nullable
@Override
public MinecraftServer getServer() {
return Minecraft.getInstance().getServer();
}
@Override | public Side getPhysicalSide() { |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/network/mixin/CPacketHandler.java | // Path: src/main/java/com/openmodloader/network/IPacketData.java
// public interface IPacketData {
// Identifier getChannel();
//
// PacketByteBuf getData();
// }
| import com.openmodloader.network.IPacketData;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.network.handler.NetworkGameHandlerClient;
import net.minecraft.network.packet.client.CPacketCustomPayload; | package com.openmodloader.network.mixin;
@Mixin(value = NetworkGameHandlerClient.class)
public abstract class CPacketHandler {
@Rewrite(behavior = Rewrite.Behavior.END)
public void onCustomPayload(CPacketCustomPayload packet) { | // Path: src/main/java/com/openmodloader/network/IPacketData.java
// public interface IPacketData {
// Identifier getChannel();
//
// PacketByteBuf getData();
// }
// Path: src/main/java/com/openmodloader/network/mixin/CPacketHandler.java
import com.openmodloader.network.IPacketData;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.network.handler.NetworkGameHandlerClient;
import net.minecraft.network.packet.client.CPacketCustomPayload;
package com.openmodloader.network.mixin;
@Mixin(value = NetworkGameHandlerClient.class)
public abstract class CPacketHandler {
@Rewrite(behavior = Rewrite.Behavior.END)
public void onCustomPayload(CPacketCustomPayload packet) { | IPacketData packetData = (IPacketData) packet; |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/mixin/MixinGuiScreen.java | // Path: src/main/java/com/openmodloader/core/event/GuiEvent.java
// public abstract class GuiEvent<T extends GuiScreen> implements IEvent {
// protected final T gui;
//
// public GuiEvent(T gui) {
// this.gui = gui;
// }
//
// public T getGui() {
// return gui;
// }
//
// public static class Open<T extends GuiScreen> extends GuiEvent<T> {
// public Open(T gui) {
// super(gui);
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
// return GenericEventTarget.of(Open.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
// return GenericEventTarget.of(Open.class, GuiScreen.class);
// }
// }
//
// public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
// protected final TextRenderer textRenderer;
//
// public Draw(T gui, TextRenderer textRenderer) {
// super(gui);
// this.textRenderer = textRenderer;
// }
//
// public TextRenderer getTextRenderer() {
// return textRenderer;
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
// return GenericEventTarget.of(Draw.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target() {
// return GenericEventTarget.of(Draw.class, GuiScreen.class);
// }
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
| import com.openmodloader.core.event.GuiEvent;
import com.openmodloader.loader.OpenModLoader;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer; | package com.openmodloader.loader.mixin;
@Mixin(GuiScreen.class)
public abstract class MixinGuiScreen {
protected TextRenderer textRenderer;
@Rewrite(behavior = Rewrite.Behavior.END)
public void draw(int mouseX, int mouseY, float aFloat3) {
GuiScreen screen = (GuiScreen) (Object) this; | // Path: src/main/java/com/openmodloader/core/event/GuiEvent.java
// public abstract class GuiEvent<T extends GuiScreen> implements IEvent {
// protected final T gui;
//
// public GuiEvent(T gui) {
// this.gui = gui;
// }
//
// public T getGui() {
// return gui;
// }
//
// public static class Open<T extends GuiScreen> extends GuiEvent<T> {
// public Open(T gui) {
// super(gui);
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
// return GenericEventTarget.of(Open.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
// return GenericEventTarget.of(Open.class, GuiScreen.class);
// }
// }
//
// public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
// protected final TextRenderer textRenderer;
//
// public Draw(T gui, TextRenderer textRenderer) {
// super(gui);
// this.textRenderer = textRenderer;
// }
//
// public TextRenderer getTextRenderer() {
// return textRenderer;
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
// return GenericEventTarget.of(Draw.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target() {
// return GenericEventTarget.of(Draw.class, GuiScreen.class);
// }
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
// Path: src/main/java/com/openmodloader/loader/mixin/MixinGuiScreen.java
import com.openmodloader.core.event.GuiEvent;
import com.openmodloader.loader.OpenModLoader;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer;
package com.openmodloader.loader.mixin;
@Mixin(GuiScreen.class)
public abstract class MixinGuiScreen {
protected TextRenderer textRenderer;
@Rewrite(behavior = Rewrite.Behavior.END)
public void draw(int mouseX, int mouseY, float aFloat3) {
GuiScreen screen = (GuiScreen) (Object) this; | OpenModLoader.get().getEventDispatcher().dispatch(new GuiEvent.Draw<>(screen, textRenderer)); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/mixin/MixinGuiScreen.java | // Path: src/main/java/com/openmodloader/core/event/GuiEvent.java
// public abstract class GuiEvent<T extends GuiScreen> implements IEvent {
// protected final T gui;
//
// public GuiEvent(T gui) {
// this.gui = gui;
// }
//
// public T getGui() {
// return gui;
// }
//
// public static class Open<T extends GuiScreen> extends GuiEvent<T> {
// public Open(T gui) {
// super(gui);
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
// return GenericEventTarget.of(Open.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
// return GenericEventTarget.of(Open.class, GuiScreen.class);
// }
// }
//
// public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
// protected final TextRenderer textRenderer;
//
// public Draw(T gui, TextRenderer textRenderer) {
// super(gui);
// this.textRenderer = textRenderer;
// }
//
// public TextRenderer getTextRenderer() {
// return textRenderer;
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
// return GenericEventTarget.of(Draw.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target() {
// return GenericEventTarget.of(Draw.class, GuiScreen.class);
// }
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
| import com.openmodloader.core.event.GuiEvent;
import com.openmodloader.loader.OpenModLoader;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer; | package com.openmodloader.loader.mixin;
@Mixin(GuiScreen.class)
public abstract class MixinGuiScreen {
protected TextRenderer textRenderer;
@Rewrite(behavior = Rewrite.Behavior.END)
public void draw(int mouseX, int mouseY, float aFloat3) {
GuiScreen screen = (GuiScreen) (Object) this; | // Path: src/main/java/com/openmodloader/core/event/GuiEvent.java
// public abstract class GuiEvent<T extends GuiScreen> implements IEvent {
// protected final T gui;
//
// public GuiEvent(T gui) {
// this.gui = gui;
// }
//
// public T getGui() {
// return gui;
// }
//
// public static class Open<T extends GuiScreen> extends GuiEvent<T> {
// public Open(T gui) {
// super(gui);
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target(Class<T> target) {
// return GenericEventTarget.of(Open.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Open<T>> target() {
// return GenericEventTarget.of(Open.class, GuiScreen.class);
// }
// }
//
// public static class Draw<T extends GuiScreen> extends GuiEvent<T> {
// protected final TextRenderer textRenderer;
//
// public Draw(T gui, TextRenderer textRenderer) {
// super(gui);
// this.textRenderer = textRenderer;
// }
//
// public TextRenderer getTextRenderer() {
// return textRenderer;
// }
//
// @Override
// public IEventTarget<?> makeTarget() {
// return target(gui.getClass());
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target(Class<T> target) {
// return GenericEventTarget.of(Draw.class, target);
// }
//
// public static <T extends GuiScreen> IEventTarget<Draw<T>> target() {
// return GenericEventTarget.of(Draw.class, GuiScreen.class);
// }
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
// Path: src/main/java/com/openmodloader/loader/mixin/MixinGuiScreen.java
import com.openmodloader.core.event.GuiEvent;
import com.openmodloader.loader.OpenModLoader;
import me.modmuss50.fusion.api.Mixin;
import me.modmuss50.fusion.api.Rewrite;
import net.minecraft.client.gui.GuiScreen;
import net.minecraft.client.render.text.TextRenderer;
package com.openmodloader.loader.mixin;
@Mixin(GuiScreen.class)
public abstract class MixinGuiScreen {
protected TextRenderer textRenderer;
@Rewrite(behavior = Rewrite.Behavior.END)
public void draw(int mouseX, int mouseY, float aFloat3) {
GuiScreen screen = (GuiScreen) (Object) this; | OpenModLoader.get().getEventDispatcher().dispatch(new GuiEvent.Draw<>(screen, textRenderer)); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/core/util/Sided.java | // Path: src/main/java/com/openmodloader/api/NestedSupplier.java
// @FunctionalInterface
// public interface NestedSupplier<T> {
// Supplier<T> inner();
//
// default T get() {
// return this.inner().get();
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
| import com.openmodloader.api.NestedSupplier;
import com.openmodloader.loader.OpenModLoader;
import net.fabricmc.api.Side; | package com.openmodloader.core.util;
public class Sided<T> {
private NestedSupplier<T> physicalClient;
private NestedSupplier<T> physicalServer;
private T value;
public Sided<T> physicalClient(NestedSupplier<T> supplier) {
this.physicalClient = supplier;
return this;
}
public Sided<T> physicalServer(NestedSupplier<T> supplier) {
this.physicalServer = supplier;
return this;
}
public T get() {
if (value == null) {
value = this.compute();
}
return value;
}
private T compute() { | // Path: src/main/java/com/openmodloader/api/NestedSupplier.java
// @FunctionalInterface
// public interface NestedSupplier<T> {
// Supplier<T> inner();
//
// default T get() {
// return this.inner().get();
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
// Path: src/main/java/com/openmodloader/core/util/Sided.java
import com.openmodloader.api.NestedSupplier;
import com.openmodloader.loader.OpenModLoader;
import net.fabricmc.api.Side;
package com.openmodloader.core.util;
public class Sided<T> {
private NestedSupplier<T> physicalClient;
private NestedSupplier<T> physicalServer;
private T value;
public Sided<T> physicalClient(NestedSupplier<T> supplier) {
this.physicalClient = supplier;
return this;
}
public Sided<T> physicalServer(NestedSupplier<T> supplier) {
this.physicalServer = supplier;
return this;
}
public T get() {
if (value == null) {
value = this.compute();
}
return value;
}
private T compute() { | Side physicalSide = OpenModLoader.getContext().getPhysicalSide(); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/core/util/Sided.java | // Path: src/main/java/com/openmodloader/api/NestedSupplier.java
// @FunctionalInterface
// public interface NestedSupplier<T> {
// Supplier<T> inner();
//
// default T get() {
// return this.inner().get();
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
| import com.openmodloader.api.NestedSupplier;
import com.openmodloader.loader.OpenModLoader;
import net.fabricmc.api.Side; | package com.openmodloader.core.util;
public class Sided<T> {
private NestedSupplier<T> physicalClient;
private NestedSupplier<T> physicalServer;
private T value;
public Sided<T> physicalClient(NestedSupplier<T> supplier) {
this.physicalClient = supplier;
return this;
}
public Sided<T> physicalServer(NestedSupplier<T> supplier) {
this.physicalServer = supplier;
return this;
}
public T get() {
if (value == null) {
value = this.compute();
}
return value;
}
private T compute() { | // Path: src/main/java/com/openmodloader/api/NestedSupplier.java
// @FunctionalInterface
// public interface NestedSupplier<T> {
// Supplier<T> inner();
//
// default T get() {
// return this.inner().get();
// }
// }
//
// Path: src/main/java/com/openmodloader/loader/OpenModLoader.java
// public final class OpenModLoader {
// public static final Version VERSION = Version.valueOf("1.0.0");
//
// private static Logger LOGGER = LogManager.getFormatterLogger(OpenModLoader.class);
//
// private final ImmutableList<IModReporter> modReporters;
// private final ImmutableMap<String, ILanguageAdapter> languageAdapters;
//
// private static OpenModLoader instance;
// private static IGameContext context;
//
// private IEventDispatcher eventDispatcher = VoidEventDispatcher.INSTANCE;
//
// private ModContext installedModContext;
// private ModContext modContext;
//
// OpenModLoader(ImmutableList<IModReporter> modReporters, ImmutableMap<String, ILanguageAdapter> languageAdapters) {
// this.modReporters = modReporters;
// this.languageAdapters = languageAdapters;
// }
//
// public static void offerContext(IGameContext context) {
// if (OpenModLoader.context != null) {
// throw new IllegalStateException("OmlContext has already been initialized");
// }
// OpenModLoader.context = context;
// }
//
// public static void offerInstance(OpenModLoader instance) {
// if (OpenModLoader.instance != null) {
// throw new IllegalStateException("OpenModLoader has already been initialized!");
// }
// OpenModLoader.instance = instance;
// }
//
// public static OpenModLoader get() {
// if (instance == null) {
// throw new IllegalStateException("OpenModLoader not yet initialized!");
// }
// return instance;
// }
//
// public static IGameContext getContext() {
// return context;
// }
//
// public IEventDispatcher getEventDispatcher() {
// return eventDispatcher;
// }
//
// @Nullable
// public ModContext getInstalledModContext() {
// return installedModContext;
// }
//
// @Nullable
// public ModContext getModContext() {
// return modContext;
// }
//
// public void initialize() {
// offerInstance(this);
//
// Collection<ModCandidate> installedCandidates = collectModCandidates();
// LOGGER.info("Collected {} mod candidates", installedCandidates.size());
//
// List<Mod> installedMods = installedCandidates.stream()
// .map(ModCandidate::construct)
// .collect(Collectors.toList());
//
// List<Mod> globalMods = installedMods.stream()
// .filter(Mod::isGlobal)
// .collect(Collectors.toList());
//
// installedModContext = new ModContext(installedMods);
// modContext = new ModContext(globalMods);
//
// eventDispatcher = modContext.buildEventDispatcher();
//
// for (Registry<?> registry : Registry.REGISTRIES) {
// if (registry instanceof IdRegistry) {
// initializeRegistry((IdRegistry<?>) registry);
// }
// }
// }
//
// private Collection<ModCandidate> collectModCandidates() {
// ModReportCollector reportCollector = new ModReportCollector();
// ModConstructor constructor = new ModConstructor(this.languageAdapters);
//
// for (IModReporter reporter : modReporters) {
// reporter.apply(reportCollector, constructor);
// }
//
// return reportCollector.getCandidates();
// }
//
// private <T> void initializeRegistry(IdRegistry<T> registry) {
// for (IRegistrationConfig config : installedModContext.getRegistrationConfigs()) {
// config.registerEntries(registry);
// }
// }
// }
//
// Path: src/main/java/net/fabricmc/api/Side.java
// public enum Side {
//
// CLIENT,
// SERVER,
// UNIVERSAL;
//
// public boolean hasClient() {
// return this != SERVER;
// }
//
// public boolean hasServer() {
// return this != CLIENT;
// }
//
// public boolean isClient() {
// return this == CLIENT;
// }
//
// public boolean isServer() {
// return this == SERVER;
// }
//
// }
// Path: src/main/java/com/openmodloader/core/util/Sided.java
import com.openmodloader.api.NestedSupplier;
import com.openmodloader.loader.OpenModLoader;
import net.fabricmc.api.Side;
package com.openmodloader.core.util;
public class Sided<T> {
private NestedSupplier<T> physicalClient;
private NestedSupplier<T> physicalServer;
private T value;
public Sided<T> physicalClient(NestedSupplier<T> supplier) {
this.physicalClient = supplier;
return this;
}
public Sided<T> physicalServer(NestedSupplier<T> supplier) {
this.physicalServer = supplier;
return this;
}
public T get() {
if (value == null) {
value = this.compute();
}
return value;
}
private T compute() { | Side physicalSide = OpenModLoader.getContext().getPhysicalSide(); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/LoaderBootstrap.java | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map; | package com.openmodloader.loader;
public final class LoaderBootstrap {
private static final Logger LOGGER = LogManager.getLogger(LoaderBootstrap.class);
private final File gameDir;
private final File configDir;
private final File modsDir;
private final File librariesDir;
| // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
// Path: src/main/java/com/openmodloader/loader/LoaderBootstrap.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
package com.openmodloader.loader;
public final class LoaderBootstrap {
private static final Logger LOGGER = LogManager.getLogger(LoaderBootstrap.class);
private final File gameDir;
private final File configDir;
private final File modsDir;
private final File librariesDir;
| private final Map<String, ILanguageAdapter> languageAdapters = new HashMap<>(); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/LoaderBootstrap.java | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map; | package com.openmodloader.loader;
public final class LoaderBootstrap {
private static final Logger LOGGER = LogManager.getLogger(LoaderBootstrap.class);
private final File gameDir;
private final File configDir;
private final File modsDir;
private final File librariesDir;
private final Map<String, ILanguageAdapter> languageAdapters = new HashMap<>(); | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
// Path: src/main/java/com/openmodloader/loader/LoaderBootstrap.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
package com.openmodloader.loader;
public final class LoaderBootstrap {
private static final Logger LOGGER = LogManager.getLogger(LoaderBootstrap.class);
private final File gameDir;
private final File configDir;
private final File modsDir;
private final File librariesDir;
private final Map<String, ILanguageAdapter> languageAdapters = new HashMap<>(); | private final ImmutableList.Builder<IModReporter> modReporters = ImmutableList.builder(); |
OpenModLoader/OpenModLoader | src/main/java/com/openmodloader/loader/LoaderBootstrap.java | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
| import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map; | addModReporter(new ClasspathModReporter());
addLanguageAdapter("java", JavaLanguageAdapter.INSTANCE);
gameDir = OpenModLoader.getContext().getRunDirectory();
configDir = new File(gameDir, "config");
if (!configDir.exists()) {
configDir.mkdirs();
}
modsDir = new File(gameDir, "mods");
if (!modsDir.exists()) {
modsDir.mkdirs();
}
librariesDir = new File(gameDir, "libraries");
if (!librariesDir.exists()) {
librariesDir.mkdirs();
}
}
public void addModReporter(IModReporter reporter) {
modReporters.add(reporter);
}
public void addLanguageAdapter(String key, ILanguageAdapter adapter) {
if (languageAdapters.containsKey(key)) {
throw new IllegalArgumentException("Language adapter '" + key + "' is already registered");
}
languageAdapters.put(key, adapter);
}
public OpenModLoader create() { | // Path: src/main/java/com/openmodloader/api/IGameContext.java
// public interface IGameContext {
// File getRunDirectory();
//
// @Nullable
// MinecraftServer getServer();
//
// Side getPhysicalSide();
// }
//
// Path: src/main/java/com/openmodloader/api/loader/ILanguageAdapter.java
// public interface ILanguageAdapter {
// <T extends IModConfigurator> T constructConfigurator(Class<T> modClass) throws ModConstructionException;
// }
//
// Path: src/main/java/com/openmodloader/api/loader/IModReporter.java
// public interface IModReporter {
// void apply(ModReportCollector collector, ModConstructor constructor);
// }
// Path: src/main/java/com/openmodloader/loader/LoaderBootstrap.java
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
import com.openmodloader.api.IGameContext;
import com.openmodloader.api.loader.ILanguageAdapter;
import com.openmodloader.api.loader.IModReporter;
import org.apache.logging.log4j.LogManager;
import org.apache.logging.log4j.Logger;
import java.io.File;
import java.util.HashMap;
import java.util.Map;
addModReporter(new ClasspathModReporter());
addLanguageAdapter("java", JavaLanguageAdapter.INSTANCE);
gameDir = OpenModLoader.getContext().getRunDirectory();
configDir = new File(gameDir, "config");
if (!configDir.exists()) {
configDir.mkdirs();
}
modsDir = new File(gameDir, "mods");
if (!modsDir.exists()) {
modsDir.mkdirs();
}
librariesDir = new File(gameDir, "libraries");
if (!librariesDir.exists()) {
librariesDir.mkdirs();
}
}
public void addModReporter(IModReporter reporter) {
modReporters.add(reporter);
}
public void addLanguageAdapter(String key, ILanguageAdapter adapter) {
if (languageAdapters.containsKey(key)) {
throw new IllegalArgumentException("Language adapter '" + key + "' is already registered");
}
languageAdapters.put(key, adapter);
}
public OpenModLoader create() { | IGameContext context = OpenModLoader.getContext(); |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.