code stringlengths 73 34.1k | label stringclasses 1 value |
|---|---|
@Provides
@Singleton
@JFunkVersion
protected String providePerfLoadVersion() {
ClassLoader loader = Thread.currentThread().getContextClassLoader();
InputStream is = loader.getResourceAsStream("com/mgmtp/jfunk/common/version.txt");
try {
return IOUtils.toString(is, "UTF-8");
} catch (IOException ex) {
throw new IllegalStateException("Could not read jFunk version.", ex);
} finally {
IOUtils.closeQuietly(is);
}
} | java |
public static PairwiseAlignment create(final int threads, final SubstitutionMatrix substitutionMatrix) {
return new ParallelBiojavaPairwiseAlignment(Executors.newFixedThreadPool(threads), substitutionMatrix);
} | java |
public static MozuUrl getStatesUrl(String profileCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/profiles/{profilecode}/shippingstates");
formatter.formatUrl("profileCode", profileCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateStatesUrl(String profilecode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/shipping/admin/profiles/{profilecode}/shippingstates");
formatter.formatUrl("profilecode", profilecode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getPackageLabelUrl(String packageId, Boolean returnAsBase64Png, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/packages/{packageId}/label?returnAsBase64Png={returnAsBase64Png}");
formatter.formatUrl("packageId", packageId);
formatter.formatUrl("returnAsBase64Png", returnAsBase64Png);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static Iterable<HighScoringPair> read(final Readable readable) throws IOException {
checkNotNull(readable);
Collect collect = new Collect();
stream(readable, collect);
return collect.hsps();
} | java |
public static void stream(final Readable readable, final HspListener listener) throws IOException {
checkNotNull(readable);
checkNotNull(listener);
HspLineProcessor lineProcessor = new HspLineProcessor(listener);
CharStreams.readLines(readable, lineProcessor);
} | java |
public static MozuUrl getTreeDocumentUrl(String documentListName, String documentName, Boolean includeInactive, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}?includeInactive={includeInactive}&responseFields={responseFields}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("documentName", documentName);
formatter.formatUrl("includeInactive", includeInactive);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateTreeDocumentContentUrl(String documentListName, String documentName)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}/documentTree/{documentName}/content?folderPath={folderPath}&folderId={folderId}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("documentName", documentName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public void manageAck(final Acknowledgment acknowledgment) {
final int smid = acknowledgment.getSmsId();
final SmsStatus smsStatus = acknowledgment.getSmsStatus();
if (logger.isDebugEnabled()) {
logger.debug("Manage ack with : " +
" - smid : " + smid +
" - ack status : " + smsStatus);
}
final Sms sms = daoService.getSms(smid);
if (sms != null) {
manageAck(sms, smsStatus);
} else {
logger.error("unable to find in db sms with : " +
" - sms_id : " + smid +
"In order to update is state in DB" + smid);
}
} | java |
private void putPhoneNumberInBlackList(final String phoneNumber, final Application application ) {
// if phone number is not already in the bl (it should not append) put the phone number
// put the phone number in the black list
if (daoService.isPhoneNumberInBlackList(phoneNumber)) return;
logger.debug("Adding to black list : \n" +
" - Phone number : " + phoneNumber + "\n" +
" - Application id : " + application.getId() + "\n");
final Date currentDate = new Date(System.currentTimeMillis());
daoService.addBlacklist(new Blacklist(application, currentDate, phoneNumber));
} | java |
@RobotKeyword
public boolean jsonElementShouldMatch(String source, String jsonPath, Object value, String method, String data, String contentType) throws Exception {
boolean match = false;
if (value == null) {
throw new IllegalArgumentException("Given value was null");
}
String found = String.valueOf(findJsonElement(source, jsonPath, method, data, contentType));
if (found.equals(value)) {
System.out.println("*DEBUG* The values '" + found + "' and '" + value + "' did match");
match = true;
} else {
System.out.println("*ERROR* The values '" + found + "' and '" + value + "' did not match");
throw new JsonNotEqualException("The found value did not match, found '" + found + "', expected '" + value + "'");
}
return match;
} | java |
@RobotKeyword
public boolean jsonShouldBeEqual(String from, String to) throws Exception {
return jsonShouldBeEqual(from, to, false);
} | java |
@RobotKeyword
public boolean jsonShouldBeEqual(String from, String to, boolean useExactMatch, String method, String data, String contentType) throws Exception {
System.out.println("*DEBUG* Comparing JSON sources");
boolean equal = false;
String fromJson = requestUtil.readSource(from, method, data, contentType);
String toJson = requestUtil.readSource(to, method, data, contentType);
if (StringUtils.isNotBlank(fromJson) && StringUtils.isNotBlank(toJson)) {
if (useExactMatch) {
if (fromJson.equals(toJson)) {
System.out.println("*DEBUG* JSON strings are equal by exact compare");
equal = true;
} else {
System.out.println("*ERROR* JSON strings are NOT equal by exact compare");
equal = false;
throw new JsonNotEqualException("JSON strings are NOT equal by exact compare");
}
} else {
equal = diff.compare(fromJson, toJson);
if (!equal) {
throw new JsonNotEqualException("JSON strings are NOT equal by compare");
}
}
} else {
System.out.println("*ERROR* Either from or to JSON was empty");
throw new JsonNotValidException("One of the JSON strings is empty");
}
return equal;
} | java |
@RobotKeyword
public Object findJsonElement(String source, String jsonPath, String method, String data, String contentType) throws Exception {
System.out.println("*DEBUG* Reading jsonPath: " + jsonPath);
String json = requestUtil.readSource(source, method, data, contentType);
Object value;
try {
value = JsonPath.read(json, jsonPath);
} catch (PathNotFoundException e) {
throw new JsonElementNotFoundException("Path '" + jsonPath + "' was not found in JSON");
}
return value;
} | java |
@SuppressWarnings("unchecked")
@RobotKeyword
public boolean jsonShouldHaveElementCount(String source, String jsonPath, Integer count, String method, String data, String contentType) throws Exception {
boolean match = false;
System.out.println("*DEBUG* Reading jsonPath: " + jsonPath);
String json = requestUtil.readSource(source, method, data, contentType);
List<Object> elements = null;
Object object = null;
try {
object = JsonPath.read(json, jsonPath);
} catch (PathNotFoundException e) {
throw new JsonElementNotFoundException("Path '" + jsonPath + "' was not found in JSON");
}
if (object != null) {
// TODO: Find a way to do this without suppressing the warning
if (object instanceof List<?>) {
elements = (List<Object>) object;
if (CollectionUtils.isNotEmpty(elements)) {
match = (elements.size() == count);
if (!match) {
System.out.println("*ERROR* Element counts did not match. Expected '" + count + "', got '" + elements.size() + "'");
throw new JsonNotEqualException("Element counts did not match. Expected '" + count + "', got '" + elements.size() + "'");
}
} else {
// In practice, it's impossible to end here.
System.out.println("*ERROR* Could not find elements from '" + jsonPath + "'");
throw new JsonElementNotFoundException("Could not find elements from '" + jsonPath + "'");
}
} else if (count == 1) {
System.out.println("*DEBUG* Found 1 item as expected from '" + jsonPath + "'");
match = true;
} else {
System.out.println("*ERROR* Found 1 item, but expected '" + count + "'");
throw new JsonElementNotFoundException("Found 1 item, but expected '" + count + "'");
}
} else {
System.out.println("*ERROR* Could not find elements from '" + jsonPath + "'");
throw new JsonElementNotFoundException("Could not find elements from '" + jsonPath + "'");
}
return match;
} | java |
public static MozuUrl getFileUrl(String applicationKey, String fileName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/appdev/filebasedpackage/packages/{applicationKey}?fileName={fileName}");
formatter.formatUrl("applicationKey", applicationKey);
formatter.formatUrl("fileName", fileName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.HOME_POD) ;
} | java |
public static MozuUrl executeUrl(String cardType, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/payments/tokens/{cardType}/execute?responseFields={responseFields}");
formatter.formatUrl("cardType", cardType);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getPublishSetUrl(String publishSetCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/publishing/publishsets/{publishSetCode}?responseFields={responseFields}");
formatter.formatUrl("publishSetCode", publishSetCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl discardDraftsUrl()
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/publishing/discarddrafts");
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl publishDraftsUrl()
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/publishing/publishdrafts");
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getOrderItemViaLineIdUrl(Boolean draft, Integer lineId, String orderId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{lineId}?draft={draft}&responseFields={responseFields}");
formatter.formatUrl("draft", draft);
formatter.formatUrl("lineId", lineId);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl createOrderItemUrl(String orderId, String responseFields, Boolean skipInventoryCheck, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items?updatemode={updateMode}&version={version}&skipInventoryCheck={skipInventoryCheck}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("skipInventoryCheck", skipInventoryCheck);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateOrderItemDiscountUrl(Integer discountId, String orderId, String orderItemId, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/discounts/{discountId}?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("discountId", discountId);
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("orderItemId", orderItemId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateItemProductPriceUrl(String orderId, String orderItemId, Double price, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/price/{price}?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("orderItemId", orderItemId);
formatter.formatUrl("price", price);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateItemQuantityUrl(String orderId, String orderItemId, Integer quantity, String responseFields, String updateMode, String version)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/orders/{orderId}/items/{orderItemId}/quantity/{quantity}?updatemode={updateMode}&version={version}&responseFields={responseFields}");
formatter.formatUrl("orderId", orderId);
formatter.formatUrl("orderItemId", orderItemId);
formatter.formatUrl("quantity", quantity);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("updateMode", updateMode);
formatter.formatUrl("version", version);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static void write(final BedRecord record, final PrintWriter writer) {
checkNotNull(record);
checkNotNull(writer);
writer.println(record.toString());
} | java |
public static void write(final Iterable<BedRecord> records, final PrintWriter writer) {
checkNotNull(records);
checkNotNull(writer);
for (BedRecord record : records) {
writer.println(record.toString());
}
} | java |
public static MozuUrl updateAccountCardUrl(Integer accountId, String cardId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/cards/{cardId}?responseFields={responseFields}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("cardId", cardId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteAccountCardUrl(Integer accountId, String cardId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/customer/accounts/{accountId}/cards/{cardId}");
formatter.formatUrl("accountId", accountId);
formatter.formatUrl("cardId", cardId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public <T> T get(final Object key) {
@SuppressWarnings("unchecked")
// cast is not safe but convenient
T value = (T) additionalData.get(key);
return value;
} | java |
public static MozuUrl getReturnNoteUrl(String noteId, String responseFields, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/notes/{noteId}?responseFields={responseFields}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteReturnNoteUrl(String noteId, String returnId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/returns/{returnId}/notes/{noteId}");
formatter.formatUrl("noteId", noteId);
formatter.formatUrl("returnId", returnId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getAssignedDiscountsUrl(String couponSetCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}/assigneddiscounts");
formatter.formatUrl("couponSetCode", couponSetCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl unAssignDiscountUrl(String couponSetCode, Integer discountId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}/assigneddiscounts/{discountId}");
formatter.formatUrl("couponSetCode", couponSetCode);
formatter.formatUrl("discountId", discountId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getDiscountContentUrl(Integer discountId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/discounts/{discountId}/content?responseFields={responseFields}");
formatter.formatUrl("discountId", discountId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteDiscountUrl(Integer discountId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/discounts/{discountId}");
formatter.formatUrl("discountId", discountId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public long initMathRandom(final Long seed) {
if (seed == null) {
mathRandom = new MathRandom();
} else {
mathRandom = new MathRandom(seed);
}
return mathRandom.getSeed();
} | java |
@Override
protected String initValuesImpl(final FieldCase c) {
double d = 0.0;
String v = source.initValues(c);
if (v != null && v.length() > 0) {
d = 0.0;
try {
Number n = format.parse(v);
d = n.doubleValue();
} catch (ParseException e) {
log.debug("Could not parse string " + v + " to a number; setting value 0.0");
}
}
d *= factor;
return format.format(d);
} | java |
public static MozuUrl getDocumentListTypeUrl(String documentListTypeFQN, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlistTypes/{documentListTypeFQN}?responseFields={responseFields}");
formatter.formatUrl("documentListTypeFQN", documentListTypeFQN);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static void write(final VcfHeader header,
final List<VcfSample> samples,
final List<VcfRecord> records,
final PrintWriter writer) {
writeHeader(header, writer);
writeColumnHeader(samples, writer);
writeRecords(samples, records, writer);
} | java |
public static void writeHeader(final VcfHeader header, final PrintWriter writer) {
checkNotNull(header);
checkNotNull(writer);
for (String meta : header.getMeta()) {
writer.println(meta);
}
} | java |
public static void writeColumnHeader(final List<VcfSample> samples, final PrintWriter writer) {
checkNotNull(samples);
checkNotNull(writer);
StringBuilder sb = new StringBuilder("#CHROM\tPOS\tID\tREF\tALT\tQUAL\tFILTER\tINFO");
if (!samples.isEmpty()) {
sb.append("\tFORMAT");
}
for (VcfSample sample : samples) {
sb.append("\t");
sb.append(sample.getId());
}
writer.println(sb.toString());
} | java |
public static void writeRecords(final List<VcfSample> samples,
final List<VcfRecord> records,
final PrintWriter writer) {
checkNotNull(samples);
checkNotNull(records);
checkNotNull(writer);
for (VcfRecord record : records) {
writeRecord(samples, record, writer);
}
} | java |
public static void writeRecord(final List<VcfSample> samples, final VcfRecord record, final PrintWriter writer) {
checkNotNull(samples);
checkNotNull(record);
checkNotNull(writer);
StringBuilder sb = new StringBuilder();
sb.append(record.getChrom());
sb.append("\t");
sb.append(record.getPos());
sb.append("\t");
if (record.getId().length == 0) {
sb.append(".");
}
else {
sb.append(Joiner.on(";").join(record.getId()));
}
sb.append("\t");
sb.append(record.getRef());
sb.append("\t");
sb.append(Joiner.on(",").join(record.getAlt()));
sb.append("\t");
if (Double.isNaN(record.getQual())) {
sb.append(".");
}
else {
sb.append((int) record.getQual());
}
sb.append("\t");
sb.append(Joiner.on(";").join(record.getFilter()));
sb.append("\t");
if (record.getInfo().isEmpty()) {
sb.append(".");
}
else {
sb.append(Joiner.on(";").withKeyValueSeparator("=").join(record.getInfo().asMap()));
}
if (!samples.isEmpty()) {
sb.append("\t");
sb.append(Joiner.on(":").join(record.getFormat()));
for (VcfSample sample : samples) {
sb.append("\t");
List<String> values = new ArrayList<String>();
for (String formatId : record.getFormat()) {
List<String> fieldValues = record.getGenotypes().get(sample.getId()).getFields().get(formatId);
values.add(fieldValues.isEmpty() ? "." : Joiner.on(",").join(fieldValues));
}
sb.append(Joiner.on(":").join(values));
}
}
writer.println(sb.toString());
} | java |
public CharacterSet getInverse() {
CharacterSet n = new CharacterSet();
n.forbiddenCharacters = characters;
n.characters = forbiddenCharacters;
return n;
} | java |
public char getCharacter(final int index) {
if (index > characters.length) {
throw new IndexOutOfBoundsException(index + "@" + characters.length + " does not fit");
}
return characters[index];
} | java |
public static CharacterSet createCharacterSet(final String encoding, final String goodExpression, final String badExpression,
final String characterSetId) throws UnsupportedEncodingException {
if (characterSets.get().containsKey(characterSetId)) {
LOG.info("CharacterSet with id=" + characterSetId + " already created");
return characterSets.get().get(characterSetId);
}
CharacterSet cs = new CharacterSet(encoding, goodExpression, badExpression, characterSetId);
characterSets.get().put(characterSetId, cs);
LOG.info("Added " + cs);
return cs;
} | java |
public static MozuUrl getOptionsUrl(Integer productTypeId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options");
formatter.formatUrl("productTypeId", productTypeId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getOptionUrl(String attributeFQN, Integer productTypeId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productTypeId", productTypeId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl addOptionUrl(Integer productTypeId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options?responseFields={responseFields}");
formatter.formatUrl("productTypeId", productTypeId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteOptionUrl(String attributeFQN, Integer productTypeId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/attributedefinition/producttypes/{productTypeId}/Options/{attributeFQN}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productTypeId", productTypeId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public void addToBlacklists(final Blacklist blacklist) {
if (null == getBlacklists()) {
setBlacklists(new java.util.TreeSet<Blacklist>());
}
getBlacklists().add(blacklist);
} | java |
public String get(final Object key, final boolean process) {
String value = propsMap.get(key);
if (process) {
value = processPropertyValue(value);
}
return value == null && defaults != null ? defaults.get(key) : value;
} | java |
@Override
public String put(final String key, final String value) {
return propsMap.put(key, value);
} | java |
@Override
public Set<Entry<String, String>> entrySet() {
if (entrySet == null) {
entrySet = new EntrySet();
}
return entrySet;
} | java |
@Override
public String remove(final Object key) {
String result = propsMap.remove(key);
if (defaults != null) {
String s = defaults.remove(key);
if (result == null) {
result = s;
}
}
return result;
} | java |
public void load(final InputStream is, final String encoding) throws IOException {
load(new InputStreamReader(is, encoding));
} | java |
public void store(final OutputStream os, final String comments, final boolean sorted, final boolean process)
throws IOException {
store(new OutputStreamWriter(os), comments, sorted, process);
} | java |
public void store(final Writer writer, final String comments, final boolean sorted, final boolean process) throws IOException {
BufferedWriter bw = writer instanceof BufferedWriter ? (BufferedWriter) writer : new BufferedWriter(writer);
if (comments != null) {
for (Scanner scanner = new Scanner(comments); scanner.hasNextLine();) {
bw.write("#");
bw.write(scanner.nextLine());
bw.newLine();
}
}
bw.write("#" + new Date());
bw.newLine();
Set<String> keys = keySet();
if (sorted) {
keys = Sets.newTreeSet(keys);
}
for (String key : keys) {
/*
* No need to escape embedded and trailing spaces for value, hence pass false to flag.
*/
bw.write(saveConvert(key, true) + "=" + saveConvert(get(key, process), false));
bw.newLine();
}
bw.flush();
} | java |
public static MozuUrl getExtraValueLocalizedDeltaPriceUrl(String attributeFQN, String currencyCode, String productCode, String responseFields, String value)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}/Values/{value}/localizedDeltaPrice/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("value", value);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getExtraUrl(String attributeFQN, String productCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/products/{productCode}/Extras/{attributeFQN}?responseFields={responseFields}");
formatter.formatUrl("attributeFQN", attributeFQN);
formatter.formatUrl("productCode", productCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getCouponSetsUrl(String filter, Boolean includeCounts, Integer pageSize, String responseFields, String sortBy, Integer startIndex)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/?startIndex={startIndex}&pageSize={pageSize}&sortBy={sortBy}&filter={filter}&includeCounts={includeCounts}&responseFields={responseFields}");
formatter.formatUrl("filter", filter);
formatter.formatUrl("includeCounts", includeCounts);
formatter.formatUrl("pageSize", pageSize);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("sortBy", sortBy);
formatter.formatUrl("startIndex", startIndex);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getCouponSetUrl(String couponSetCode, Boolean includeCounts, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}?includeCounts={includeCounts}&responseFields={responseFields}");
formatter.formatUrl("couponSetCode", couponSetCode);
formatter.formatUrl("includeCounts", includeCounts);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateCouponSetUrl(String couponSetCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/couponsets/{couponSetCode}?responseFields={responseFields}");
formatter.formatUrl("couponSetCode", couponSetCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateDocumentListUrl(String documentListName, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}?responseFields={responseFields}");
formatter.formatUrl("documentListName", documentListName);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteDocumentListUrl(String documentListName)
{
UrlFormatter formatter = new UrlFormatter("/api/content/documentlists/{documentListName}");
formatter.formatUrl("documentListName", documentListName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
private int s2i(final byte[] bytes) {
int num = 0;
for (int i = 0; i < 4; i++) {
num += (bytes[i] & 0xff) << ((3 - i) * 8);
}
return num;
} | java |
public FormEntry getFormEntry(final String entryKey) {
FormEntry entry = entries.get(entryKey);
if (entry == null) {
entry = addFormEntry(entryKey, null);
}
return entry;
} | java |
private void resetValues(final Constraint constraintContainer) {
log.info("Reset " + key + " form data");
for (FormEntry e : entries.values()) {
e.resetValue();
}
constraintContainer.resetValues();
} | java |
public static MozuUrl deleteEntityListUrl(String entityListFullName)
{
UrlFormatter formatter = new UrlFormatter("/api/platform/entitylists/{entityListFullName}");
formatter.formatUrl("entityListFullName", entityListFullName);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static VcfHeader header(final File file) throws IOException {
checkNotNull(file);
// could also use Files.asCharSource(file, Charsets.UTF_8).openBufferedStream()
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
return header(reader);
}
} | java |
public static VcfHeader header(final URL url) throws IOException {
checkNotNull(url);
try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
return header(reader);
}
} | java |
public static VcfHeader header(final InputStream inputStream) throws IOException {
checkNotNull(inputStream);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
return header(reader);
}
} | java |
public static Iterable<VcfSample> samples(final File file) throws IOException {
checkNotNull(file);
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
return samples(reader);
}
} | java |
public static Iterable<VcfSample> samples(final URL url) throws IOException {
checkNotNull(url);
try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
return samples(reader);
}
} | java |
public static Iterable<VcfSample> samples(final InputStream inputStream) throws IOException {
checkNotNull(inputStream);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
return samples(reader);
}
} | java |
public static Iterable<VcfRecord> records(final File file) throws IOException {
checkNotNull(file);
try (BufferedReader reader = new BufferedReader(new FileReader(file))) {
return records(reader);
}
} | java |
public static Iterable<VcfRecord> records(final URL url) throws IOException {
checkNotNull(url);
try (BufferedReader reader = Resources.asCharSource(url, Charsets.UTF_8).openBufferedStream()) {
return records(reader);
}
} | java |
public static Iterable<VcfRecord> records(final InputStream inputStream) throws IOException {
checkNotNull(inputStream);
try (BufferedReader reader = new BufferedReader(new InputStreamReader(inputStream))) {
return records(reader);
}
} | java |
private void cleanUp(final DataSet ds) {
Set<String> indexedKeys = Sets.newHashSet();
for (String key : ds.getDataView().keySet()) {
// Search for indexed entries
if (key.contains("#")) {
// Remember key (without index)
indexedKeys.add(key.substring(0, key.indexOf("#")));
}
}
// Remove all indexes
for (String indexedKey : indexedKeys) {
ds.removeValue(indexedKey);
}
} | java |
public static MozuUrl getChildCategoriesUrl(Integer categoryId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/children?responseFields={responseFields}");
formatter.formatUrl("categoryId", categoryId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl addCategoryUrl(Boolean incrementSequence, String responseFields, Boolean useProvidedId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/?incrementSequence={incrementSequence}&useProvidedId={useProvidedId}&responseFields={responseFields}");
formatter.formatUrl("incrementSequence", incrementSequence);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("useProvidedId", useProvidedId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl addProductsToCategoryUrl(Integer categoryId)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/add-products");
formatter.formatUrl("categoryId", categoryId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateCategoryUrl(Boolean cascadeVisibility, Integer categoryId, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}?cascadeVisibility={cascadeVisibility}&responseFields={responseFields}");
formatter.formatUrl("cascadeVisibility", cascadeVisibility);
formatter.formatUrl("categoryId", categoryId);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteCategoryByIdUrl(Boolean cascadeDelete, Integer categoryId, Boolean forceDelete, Boolean reassignToParent)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/categories/{categoryId}/?cascadeDelete={cascadeDelete}&forceDelete={forceDelete}&reassignToParent={reassignToParent}");
formatter.formatUrl("cascadeDelete", cascadeDelete);
formatter.formatUrl("categoryId", categoryId);
formatter.formatUrl("forceDelete", forceDelete);
formatter.formatUrl("reassignToParent", reassignToParent);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl getDeliveryAttemptSummaryUrl(Integer processId, String responseFields, String subscriptionId)
{
UrlFormatter formatter = new UrlFormatter("/api/event/push/subscriptions/{subscriptionId}/deliveryattempts/{id}?responseFields={responseFields}");
formatter.formatUrl("processId", processId);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("subscriptionId", subscriptionId);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static void write(final Hml data, final Writer writer) throws IOException {
checkNotNull(data);
checkNotNull(writer);
try {
JAXBContext context = JAXBContext.newInstance(Hml.class);
Marshaller marshaller = context.createMarshaller();
SchemaFactory schemaFactory = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
URL schemaURL = HmlReader.class.getResource("/org/nmdp/ngs/hml/xsd/hml-1.0.1.xsd");
Schema schema = schemaFactory.newSchema(schemaURL);
marshaller.setSchema(schema);
marshaller.setProperty(Marshaller.JAXB_FORMATTED_OUTPUT, true);
marshaller.marshal(data, writer);
}
catch (JAXBException | SAXException e) {
e.printStackTrace();
throw new IOException("could not marshal HML", e);
}
} | java |
public static void write(final Hml data, final File file) throws IOException {
checkNotNull(data);
checkNotNull(file);
try (BufferedWriter writer = new BufferedWriter(new FileWriter(file))) {
write(data, writer);
}
} | java |
public static void write(final Hml data, final OutputStream outputStream) throws IOException {
checkNotNull(data);
checkNotNull(outputStream);
try (BufferedWriter writer = new BufferedWriter(new OutputStreamWriter(outputStream))) {
write(data, writer);
}
} | java |
public static MozuUrl getCurrencyExchangeRateUrl(String currencyCode, String responseFields, String toCurrencyCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("responseFields", responseFields);
formatter.formatUrl("toCurrencyCode", toCurrencyCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl updateCurrencyLocalizationUrl(String currencyCode, String responseFields)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}?responseFields={responseFields}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("responseFields", responseFields);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteCurrencyLocalizationUrl(String currencyCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}");
formatter.formatUrl("currencyCode", currencyCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public static MozuUrl deleteCurrencyExchangeRateUrl(String currencyCode, String toCurrencyCode)
{
UrlFormatter formatter = new UrlFormatter("/api/commerce/catalog/admin/currency/{currencyCode}/exchangerates/{toCurrencyCode}");
formatter.formatUrl("currencyCode", currencyCode);
formatter.formatUrl("toCurrencyCode", toCurrencyCode);
return new MozuUrl(formatter.getResourceUrl(), MozuUrl.UrlLocation.TENANT_POD) ;
} | java |
public MailAccount reserveMailAccount(final String accountReservationKey, final String pool) {
if (pool == null && emailAddressPools.keySet().size() > 1) {
throw new IllegalStateException("No pool specified but multiple pools available.");
}
String poolKey = pool == null ? defaultPool : pool;
List<MailAccount> addressPool = newArrayList(emailAddressPools.get(poolKey));
Collections.shuffle(addressPool, random.getRandom());
return reserveAvailableMailAccount(accountReservationKey, addressPool);
} | java |
public MailAccount lookupUsedMailAccountForCurrentThread(final String accountReservationKey) {
lock.lock();
try {
Map<MailAccount, ThreadReservationKeyWrapper> usedAccountsForThread = filterValues(usedAccounts, new CurrentThreadWrapperPredicate());
if (!usedAccountsForThread.isEmpty()) {
for (Entry<MailAccount, ThreadReservationKeyWrapper> entry : usedAccountsForThread.entrySet()) {
if (entry.getValue().accountReservationKey.equals(accountReservationKey)) {
return entry.getKey();
}
}
}
return null;
} finally {
lock.unlock();
}
} | java |
public Set<MailAccount> getReservedMailAccountsForCurrentThread() {
lock.lock();
try {
Map<MailAccount, ThreadReservationKeyWrapper> accountsForThread = filterValues(usedAccounts, new CurrentThreadWrapperPredicate());
return ImmutableSet.copyOf(accountsForThread.keySet());
} finally {
lock.unlock();
}
} | java |
public Set<String> getRegisteredAccountReservationKeysForCurrentThread() {
lock.lock();
try {
Map<MailAccount, String> accountsForThread = transformValues(filterValues(usedAccounts, new CurrentThreadWrapperPredicate()),
new Function<ThreadReservationKeyWrapper, String>() {
@Override
public String apply(final ThreadReservationKeyWrapper input) {
return input.accountReservationKey;
}
}
);
return ImmutableSet.copyOf(accountsForThread.values());
} finally {
lock.unlock();
}
} | java |
public void releaseAllMailAccountsForThread() {
log.info("Releasing all mail accounts for the current thread...");
lock.lock();
try {
for (Iterator<Entry<MailAccount, ThreadReservationKeyWrapper>> it = usedAccounts.entrySet().iterator(); it.hasNext(); ) {
ThreadReservationKeyWrapper wrapper = it.next().getValue();
if (wrapper.thread == Thread.currentThread()) {
it.remove();
}
}
condition.signalAll();
} finally {
lock.unlock();
}
} | java |
public void releaseMailAccountForThread(final MailAccount account) {
log.info("Releasing mail account for the current thread: {}", account);
lock.lock();
try {
ThreadReservationKeyWrapper wrapper = usedAccounts.get(account);
if (wrapper != null) {
if (wrapper.thread == Thread.currentThread()) {
log.debug("Releasing mail account: {}", account);
usedAccounts.remove(account);
condition.signalAll();
} else {
log.warn("Cannot release a mail account reserved by a different thread: {}", account);
}
}
} finally {
lock.unlock();
}
} | java |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.