_id stringlengths 2 7 | title stringlengths 3 140 | partition stringclasses 3
values | text stringlengths 73 34.1k | language stringclasses 1
value | meta_information dict |
|---|---|---|---|---|---|
q163600 | AuditService.getAudit | train | public Audit getAudit(BigInteger id) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + id.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidResponse(response, requestUrl);
ret... | java | {
"resource": ""
} |
q163601 | AnnotationQuery.setTag | train | @JsonIgnore
public void setTag(String key, String value) {
requireArgument(key != null && !key.trim().isEmpty(), "Tag key cannot be null.");
requireArgument(!ReservedField.isReservedField(key), "Tag is a reserved tag name.");
if (value == null || value.isEmpty()) {
_tags.remove(k... | java | {
"resource": ""
} |
q163602 | AnnotationQuery.getTag | train | @JsonIgnore
public String getTag(String key) {
return (!Metric.ReservedField.isReservedField(key)) ? _tags.get(key) : null;
} | java | {
"resource": ""
} |
q163603 | AnnotationQuery.setTags | train | public final void setTags(Map<String, String> tags) {
Map<String, String> updatedTags = new TreeMap<>();
if (tags != null) {
for (Map.Entry<String, String> entry : tags.entrySet()) {
String key = entry.getKey();
requireArgument(!Metric.ReservedField.isReserv... | java | {
"resource": ""
} |
q163604 | AnnotationQuery.setScope | train | protected void setScope(String scope) {
requireArgument(scope != null && !scope.isEmpty(), "Scope cannot be null or empty.");
_scope = scope;
} | java | {
"resource": ""
} |
q163605 | AnnotationQuery.setMetric | train | protected void setMetric(String metric) {
requireArgument(metric != null && !metric.isEmpty(), "Metric name cannot be null or empty.");
_metric = metric;
} | java | {
"resource": ""
} |
q163606 | AnnotationQuery.toTagParameterArray | train | protected String toTagParameterArray(Map<String, String> tags) throws UnsupportedEncodingException {
if(tags == null || tags.isEmpty()) {
return "";
}
StringBuilder sb = new StringBuilder(encode("{", "UTF-8"));
for (Map.Entry<String, String> tagEntry : tags.entrySet()) {
... | java | {
"resource": ""
} |
q163607 | AnomalyDetectionTransform.getMinMax | train | private Map<String, Double> getMinMax(Map<Long, Double> metricData) {
double min = 0.0;
double max = 0.0;
boolean isMinMaxSet = false;
for (Double value : metricData.values()) {
double valueDouble = value;
if (!isMinMaxSet) {
min = valueDouble;
... | java | {
"resource": ""
} |
q163608 | Main.main | train | static void main(String[] args, PrintStream out) throws IOException {
try {
Main main = null;
Option[] options = Option.parseCLArgs(args, TEMPLATES);
Option helpOption = (options == null) ? null : findOption(HELP_OPTION.getName(), options);
Option installOption = ... | java | {
"resource": ""
} |
q163609 | Main.invoke | train | void invoke(ClientType clientType) {
try {
LOGGER.info("Starting service.");
ExecutorService service = ClientServiceFactory.startClientService(_system, clientType, _jobCounter);
LOGGER.info("Service started.");
Thread currentThread = Thread.currentThread();
... | java | {
"resource": ""
} |
q163610 | Barrier.enter | train | public boolean enter() throws KeeperException, InterruptedException{
zooKeeper.create(rootPath + "/" + name, new byte[0], Ids.OPEN_ACL_UNSAFE, CreateMode.EPHEMERAL);
while (true) {
synchronized (mutex) {
List<String> list = zooKeeper.getChildren(rootPath, true);
if (list.size() < size) {
mutex.wait... | java | {
"resource": ""
} |
q163611 | Barrier.leave | train | public boolean leave() throws KeeperException, InterruptedException{
zooKeeper.delete(rootPath + "/" + name, 0);
while (true) {
synchronized (mutex) {
List<String> list = zooKeeper.getChildren(rootPath, true);
if (list.size() > 0) {
mutex.wait();
} else {
return true;
}
}
}
} | java | {
"resource": ""
} |
q163612 | MetricService.getMetrics | train | public List<Metric> getMetrics(List<String> expressions) throws IOException, TokenExpiredException {
StringBuilder requestUrl = new StringBuilder(RESOURCE);
for (int i = 0; i < expressions.size(); i++) {
requestUrl.append(i == 0 ? "?" : "&");
requestUrl.append("expression=").app... | java | {
"resource": ""
} |
q163613 | GlobalInterlock.obtainLock | train | public static String obtainLock(EntityManager em, long expiration, long type, String note) {
EntityTransaction tx = null;
/* remove the existing lock if it's expired */
try {
long now = System.currentTimeMillis();
tx = em.getTransaction();
tx.begin();
... | java | {
"resource": ""
} |
q163614 | GlobalInterlock.releaseLock | train | public static void releaseLock(EntityManager em, long type, String key) {
EntityTransaction tx = null;
/* remove the existing lock if it matches the key. */
try {
tx = em.getTransaction();
tx.begin();
GlobalInterlock lock = _findAndRefreshLock(em, type);
... | java | {
"resource": ""
} |
q163615 | GlobalInterlock.refreshLock | train | public static String refreshLock(EntityManager em, long type, String key, String note) {
EntityTransaction tx = null;
/* refresh the existing lock if it matches the key. */
try {
tx = em.getTransaction();
tx.begin();
GlobalInterlock lock = _findAndRefreshLoc... | java | {
"resource": ""
} |
q163616 | AuditDto.transformToDto | train | public static AuditDto transformToDto(Audit audit) {
if (audit == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
AuditDto auditDto = new AuditDto();
try {
auditDto.setId(audit.... | java | {
"resource": ""
} |
q163617 | AuditDto.transformToDto | train | public static List<AuditDto> transformToDto(List<Audit> audits) {
if (audits == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<AuditDto> result = new ArrayList<AuditDto>();
for (Audit ... | java | {
"resource": ""
} |
q163618 | SuspensionRecord.findInfractionCount | train | public static int findInfractionCount(EntityManager em, PrincipalUser user, SubSystem subSystem, long startTime) {
List<SuspensionRecord> records;
if (subSystem == null) {
records = findByUser(em, user);
} else {
SuspensionRecord record = findByUserAndSubsystem(em, user,... | java | {
"resource": ""
} |
q163619 | SuspensionRecord.findByUserAndSubsystem | train | public static SuspensionRecord findByUserAndSubsystem(EntityManager em, PrincipalUser user, SubSystem subSystem) {
TypedQuery<SuspensionRecord> query = em.createNamedQuery("SuspensionRecord.findByUserAndSubsystem", SuspensionRecord.class);
try {
query.setParameter("user", user);
... | java | {
"resource": ""
} |
q163620 | SuspensionRecord.findByUser | train | public static List<SuspensionRecord> findByUser(EntityManager em, PrincipalUser user) {
TypedQuery<SuspensionRecord> query = em.createNamedQuery("SuspensionRecord.findByUser", SuspensionRecord.class);
try {
query.setParameter("user", user);
return query.getResultList();
... | java | {
"resource": ""
} |
q163621 | SuspensionRecord.setInfractionHistory | train | public void setInfractionHistory(List<Long> history) {
SystemAssert.requireArgument(history != null && !history.isEmpty(), "Infraction History cannot be set to null or empty.");
this.infractionHistory = history;
} | java | {
"resource": ""
} |
q163622 | TSDBEntity.getTags | train | public Map<String, String> getTags() {
Map<String, String> result = new HashMap<>();
for (Map.Entry<String, String> entry : _tags.entrySet()) {
String key = entry.getKey();
if (!ReservedField.isReservedField(key)) {
result.put(key, entry.getValue());
... | java | {
"resource": ""
} |
q163623 | TSDBEntity.setTags | train | public void setTags(Map<String, String> tags) {
TSDBEntity.validateTags(tags);
_tags.clear();
if (tags != null) {
_tags.putAll(tags);
}
} | java | {
"resource": ""
} |
q163624 | Annotation.setType | train | private void setType(String type) {
requireArgument(type != null && !type.trim().isEmpty(), "Type cannot be null or empty.");
_type = type;
} | java | {
"resource": ""
} |
q163625 | Annotation.setSource | train | private void setSource(String source) {
requireArgument(source != null && !source.trim().isEmpty(), "Source cannot be null or empty.");
_source = source;
} | java | {
"resource": ""
} |
q163626 | Annotation.setId | train | private void setId(String id) {
requireArgument(id != null && !id.trim().isEmpty(), "ID cannot be null or empty.");
_id = id;
} | java | {
"resource": ""
} |
q163627 | Annotation.setFields | train | public void setFields(Map<String, String> fields) {
_fields.clear();
if (fields != null) {
_fields.putAll(fields);
}
} | java | {
"resource": ""
} |
q163628 | PolicyLimit.findPolicyLimitByUserAndCounter | train | public static PolicyLimit findPolicyLimitByUserAndCounter(EntityManager em, PrincipalUser user, PolicyCounter counter) {
TypedQuery<PolicyLimit> query = em.createNamedQuery("PolicyLimit.findPolicyLimitByUserAndCounter", PolicyLimit.class);
try {
query.setParameter("user", user);
... | java | {
"resource": ""
} |
q163629 | PolicyLimit.getLimitByUserAndCounter | train | public static double getLimitByUserAndCounter(EntityManager em, PrincipalUser user, PolicyCounter counter) {
PolicyLimit pLimit = findPolicyLimitByUserAndCounter(em, user, counter);
if (pLimit != null) {
return pLimit.getLimit();
}
return counter.getDefaultValue();
} | java | {
"resource": ""
} |
q163630 | ServiceManagementRecord.findServiceManagementRecord | train | public static ServiceManagementRecord findServiceManagementRecord(EntityManager em, Service service) {
requireArgument(em != null, "Entity manager can not be null.");
requireArgument(service != null, "Service cannot be null.");
TypedQuery<ServiceManagementRecord> query = em.createNamedQuery("Se... | java | {
"resource": ""
} |
q163631 | ServiceManagementRecord.isServiceEnabled | train | public static boolean isServiceEnabled(EntityManager em, Service service) {
ServiceManagementRecord record = findServiceManagementRecord(em, service);
return record == null ? true : record.isEnabled();
} | java | {
"resource": ""
} |
q163632 | ServiceManagementRecord.updateServiceManagementRecord | train | @Transactional
public static ServiceManagementRecord updateServiceManagementRecord(EntityManager em, ServiceManagementRecord record) {
SystemAssert.requireArgument(em != null, "Entity manager can not be null.");
SystemAssert.requireArgument(record != null, "ServiceManagementRecord cannot be null.");... | java | {
"resource": ""
} |
q163633 | DefaultAlertService._processNotification | train | private void _processNotification(Alert alert, History history, List<Metric> metrics,
Map<BigInteger, Map<Metric, Long>> triggerFiredTimesAndMetricsByTrigger, Notification notification, Long alertEnqueueTimestamp) {
//refocus notifier does not need cool down logic, and every evaluation needs to send notification... | java | {
"resource": ""
} |
q163634 | DefaultAlertService._processMissingDataNotification | train | private void _processMissingDataNotification(Alert alert, History history, Set<Trigger> triggers, Notification notification, boolean isDataMissing, Long alertEnqueueTimestamp) {
//refocus notifier does not need cool down logic, and every evaluation needs to send notification
boolean isRefocusNotifier = SupportedNo... | java | {
"resource": ""
} |
q163635 | DefaultAlertService._shouldEvaluateAlert | train | private boolean _shouldEvaluateAlert(Alert alert, BigInteger alertId) {
if (alert == null) {
_logger.warn(MessageFormat.format("Could not find alert ID {0}", alertId));
return false;
}
if(!alert.isEnabled()) {
_logger.warn(MessageFormat.format("Alert {0} has been disabled. Will not evaluate.", alert.getI... | java | {
"resource": ""
} |
q163636 | DefaultAlertService._evaluateTriggers | train | private Map<BigInteger, Map<Metric, Long>> _evaluateTriggers(Set<Trigger> triggers, List<Metric> metrics, String queryExpression, Long alertEnqueueTimestamp) {
Map<BigInteger, Map<Metric, Long>> triggerFiredTimesAndMetricsByTrigger = new HashMap<>();
for(Trigger trigger : triggers) {
Map<Metric, Long> triggerFi... | java | {
"resource": ""
} |
q163637 | DefaultAlertService.getNotifier | train | @Override
public Notifier getNotifier(SupportedNotifier notifier) {
switch (notifier) {
case CALLBACK:
return _notifierFactory.getCallbackNotifier();
case EMAIL:
return _notifierFactory.getEmailNotifier();
case GOC:
return _notifierFactory.getGOCNotifier();
case DATABASE:
return _notifierFactory.... | java | {
"resource": ""
} |
q163638 | PerfFilter.doFilter | train | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = HttpServletRequest.class.cast(request);
long start = System.currentTimeMillis();
try {
chain.doFilter(request, response);
} finally {
long d... | java | {
"resource": ""
} |
q163639 | MetricDistiller.setCommonAttributes | train | public static void setCommonAttributes(List<Metric> metrics, Metric result) {
MetricDistiller distiller = new MetricDistiller();
distiller.distill(metrics);
result.setDisplayName(distiller.getDisplayName());
result.setUnits(distiller.getUnits());
result.setTags(distiller.getTags... | java | {
"resource": ""
} |
q163640 | MetricDistiller.getTags | train | public Map<String, String> getTags() {
Map<String, String> distilledTags = new HashMap<String, String>();
for (Map.Entry<String, String> entry : potentialTags.entrySet()) {
String key = entry.getKey();
String value = entry.getValue();
if (tagCounts.get(key).equals(t... | java | {
"resource": ""
} |
q163641 | EntityDTO.createDtoObject | train | public static <D extends EntityDTO, E extends JPAEntity> D createDtoObject(Class<D> clazz, E entity) {
D result = null;
try {
result = clazz.newInstance();
BeanUtils.copyProperties(result, entity);
// Now set IDs of JPA entity
result.setCreatedById(entit... | java | {
"resource": ""
} |
q163642 | RunnableJob.execute | train | @Override
public void execute(JobExecutionContext context) throws JobExecutionException {
JobDataMap map = context.getJobDetail().getJobDataMap();
AlertService alertService = (AlertService) map.get("AlertService");
AuditService auditService = (AuditService) map.get("AuditService");
... | java | {
"resource": ""
} |
q163643 | LoggingFilter.doFilter | train | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
HttpServletRequest req = HttpServletRequest.class.cast(request);
String url = req.getRequestURI();
LoggerFactory.getLogger(getClass()).debug("Request st... | java | {
"resource": ""
} |
q163644 | Producer.enqueue | train | public <T extends Serializable> int enqueue(final String topic, List<T> objects) {
int messagesBuffered = 0;
for (T object : objects) {
final String value;
if (String.class.isAssignableFrom(object.getClass())) {
value = String.class.cast(object);
} e... | java | {
"resource": ""
} |
q163645 | Producer.shutdown | train | public void shutdown() {
if (_producer != null) {
_producer.close();
}
_executorService.shutdown();
try {
if (!_executorService.awaitTermination(10, TimeUnit.SECONDS)) {
_logger.warn("Shutdown of Kafka executor service timed out after 10 seconds.")... | java | {
"resource": ""
} |
q163646 | Notification.getMetricToAnnotate | train | public static Metric getMetricToAnnotate(String metric) {
Metric result = null;
if (metric != null && !metric.isEmpty()) {
Pattern pattern = Pattern.compile(
"([\\w,\\-,\\.,/]+):([\\w,\\-,\\.,/]+)(\\{(?:[\\w,\\-,\\.,/]+=[\\w,\\-,\\.,/,\\*,|]+)(?:,[\\w,\\-,\\.,/]+=[\\w,\\-,\\... | java | {
"resource": ""
} |
q163647 | Notification.setSubscriptions | train | public void setSubscriptions(List<String> subscriptions) {
this.subscriptions.clear();
if(subscriptions == null) return;
for(String currentSubscription: subscriptions) {
if (this.getNotifierName().equals(AlertService.SupportedNotifier.GUS.getName())) {
if (currentSubs... | java | {
"resource": ""
} |
q163648 | Notification.getCooldownExpirationByTriggerAndMetric | train | public long getCooldownExpirationByTriggerAndMetric(Trigger trigger, Metric metric) {
String key = _hashTriggerAndMetric(trigger, metric);
return this.cooldownExpirationByTriggerAndMetric.containsKey(key) ? this.cooldownExpirationByTriggerAndMetric.get(key) : 0;
} | java | {
"resource": ""
} |
q163649 | Notification.setCooldownExpirationByTriggerAndMetric | train | public void setCooldownExpirationByTriggerAndMetric(Trigger trigger, Metric metric, long cooldownExpiration) {
requireArgument(cooldownExpiration >= 0, "Cool down expiration time cannot be negative.");
String key = _hashTriggerAndMetric(trigger, metric);
this.cooldownExpirationByTriggerAndMetric.put(key, c... | java | {
"resource": ""
} |
q163650 | Notification.setMetricsToAnnotate | train | public void setMetricsToAnnotate(List<String> metricsToAnnotate) {
this.metricsToAnnotate.clear();
if (metricsToAnnotate != null && !metricsToAnnotate.isEmpty()) {
for (String metric : metricsToAnnotate) {
requireArgument(getMetricToAnnotate(metric) != null, "Metrics to annot... | java | {
"resource": ""
} |
q163651 | Notification.setTriggers | train | public void setTriggers(List<Trigger> triggers) {
this.triggers.clear();
if (triggers != null) {
this.triggers.addAll(triggers);
}
} | java | {
"resource": ""
} |
q163652 | Notification.isActiveForTriggerAndMetric | train | public boolean isActiveForTriggerAndMetric(Trigger trigger, Metric metric) {
String key = _hashTriggerAndMetric(trigger, metric);
return this.activeStatusByTriggerAndMetric.containsKey(key) ? activeStatusByTriggerAndMetric.get(key) : false;
} | java | {
"resource": ""
} |
q163653 | Notification.setActiveForTriggerAndMetric | train | public void setActiveForTriggerAndMetric(Trigger trigger, Metric metric, boolean active) {
String key = _hashTriggerAndMetric(trigger, metric);
this.activeStatusByTriggerAndMetric.put(key, active);
} | java | {
"resource": ""
} |
q163654 | Option.createFlag | train | public static Option createFlag(String name, String description) {
return new Option(Type.FLAG, name, 0, description);
} | java | {
"resource": ""
} |
q163655 | Option.createOption | train | public static Option createOption(String name, String description) {
return new Option(Type.OPTION, name, 1, description);
} | java | {
"resource": ""
} |
q163656 | Option.findListOption | train | public static Option findListOption(Option[] options) {
for (int i = 0; i < options.length; i++) {
if (options[i].getType() == Type.LIST) {
return options[i];
}
}
return null;
} | java | {
"resource": ""
} |
q163657 | Option.findOption | train | public static Option findOption(String name, Option[] options) {
for (int i = 0; i < options.length; i++) {
if (options[i].getName().equals(name)) {
return options[i];
}
}
return null;
} | java | {
"resource": ""
} |
q163658 | Option.parseCLArgs | train | public static Option[] parseCLArgs(String[] args, Option[] templates) {
int i = 0;
List<Option> options = new ArrayList<Option>(args.length);
try {
while (i < args.length) {
String name = args[i++];
Option template = findTemplate(name, templates);
... | java | {
"resource": ""
} |
q163659 | Option.findTemplate | train | private static Option findTemplate(String name, Option[] templates) {
boolean listAllowed = false;
Option listOption = null;
for (int i = 0; i < templates.length; i++) {
if (templates[i].getName().equals(name)) {
return templates[i];
}
if (Typ... | java | {
"resource": ""
} |
q163660 | Option.getValues | train | public String[] getValues() {
return value == null || value.isEmpty() ? new String[0] : len == 1 ? new String[] { value } : value.split("\\s+");
} | java | {
"resource": ""
} |
q163661 | RefocusNotifier.sendMessage | train | private void sendMessage(String aspectPath, boolean fired) {
if (Boolean.valueOf(_config.getValue(SystemConfiguration.Property.REFOCUS_ENABLED))) {
int refreshMaxTimes = Integer.parseInt(_config.getValue(Property.REFOCUS_CONNECTION_REFRESH_MAX_TIMES.getName(), Property.REFOCUS_CONNECTION_REFRESH_MAX_TIMES.getDefau... | java | {
"resource": ""
} |
q163662 | NamespaceDto.transformToDto | train | public static NamespaceDto transformToDto(Namespace namespace) {
if (namespace == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
NamespaceDto result = createDtoObject(NamespaceDto.class, namespace);... | java | {
"resource": ""
} |
q163663 | NamespaceDto.addUsername | train | public void addUsername(String username) {
SystemAssert.requireArgument(username != null && !username.isEmpty(), "Username cannot be null or empty.");
this.usernames.add(username);
} | java | {
"resource": ""
} |
q163664 | MetricSchemaRecordQuery.setScope | train | public void setScope(String scope) {
SystemAssert.requireArgument(scope != null && !scope.isEmpty(), "Scope cannot be null or empty.");
this.scope = scope;
} | java | {
"resource": ""
} |
q163665 | MetricSchemaRecordQuery.setMetric | train | public void setMetric(String metric) {
SystemAssert.requireArgument(metric != null && !metric.isEmpty(), "Metric cannot be null or empty.");
this.metric = metric;
} | java | {
"resource": ""
} |
q163666 | AlertResources.getSharedAlertsObj | train | private List<Alert> getSharedAlertsObj(boolean populateMetaFieldsOnly, PrincipalUser owner, Integer limit) {
Set<Alert> result = new HashSet<>();
result.addAll(populateMetaFieldsOnly ? alertService.findSharedAlerts(true, owner, limit) : alertService.findSharedAlerts(false, owner, limit));
return new ArrayList<... | java | {
"resource": ""
} |
q163667 | Audit.setCreatedDate | train | public void setCreatedDate(Date createdDate) {
_createdDate = createdDate == null ? null : new Date(createdDate.getTime());
} | java | {
"resource": ""
} |
q163668 | TriggerDto.transformToDto | train | public static TriggerDto transformToDto(Trigger trigger) {
TriggerDto result = createDtoObject(TriggerDto.class, trigger);
// Now copy ID fields
result.setAlertId(trigger.getAlert().getId());
for (Notification notification : trigger.getNotifications()) {
result.addNotificati... | java | {
"resource": ""
} |
q163669 | TriggerDto.transformToDto | train | public static List<TriggerDto> transformToDto(List<Trigger> triggers) {
List<TriggerDto> result = new ArrayList<TriggerDto>();
for (Trigger trigger : triggers) {
result.add(transformToDto(trigger));
}
return result;
} | java | {
"resource": ""
} |
q163670 | HistoryDTO.transformToDto | train | public static HistoryDTO transformToDto(History history) {
if (history == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
HistoryDTO historyDto = new HistoryDTO();
try {
BeanUtil... | java | {
"resource": ""
} |
q163671 | HistoryDTO.transformToDto | train | public static List<HistoryDTO> transformToDto(List<History> list) {
if (list == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
List<HistoryDTO> result = new ArrayList<HistoryDTO>();
for (Hi... | java | {
"resource": ""
} |
q163672 | DefaultJPAService.mergeEntity | train | public <E extends Identifiable> E mergeEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
E ret = em.merge(entity);
return ret;
} | java | {
"resource": ""
} |
q163673 | DefaultJPAService.deleteEntity | train | protected <E extends Identifiable> void deleteEntity(EntityManager em, E entity) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(entity != null, "The entity cannot be null.");
if (!em.contains(entity)) {
Identifiable attached = findEntity(em, entity.getId(), entity.getClass... | java | {
"resource": ""
} |
q163674 | DefaultJPAService.findEntity | train | protected <E extends Identifiable> E findEntity(EntityManager em, BigInteger id, Class<E> type) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(id != null && id.compareTo(ZERO) > 0, "ID must be positive and non-zero");
requireArgument(type != null, "The entity cannot be null."... | java | {
"resource": ""
} |
q163675 | DefaultJPAService.findEntitiesMarkedForDeletion | train | protected <E extends Identifiable> List<E> findEntitiesMarkedForDeletion(EntityManager em, Class<E> type, final int limit) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(type != null, "The entity cannot be null.");
requireArgument(limit == -1 || limit > 0, "Limit if not -1, m... | java | {
"resource": ""
} |
q163676 | AnomalyDetectionGaussianTransform.fitParameters | train | private void fitParameters(Map<Long, Double> metricData) {
mean = getMetricMean(metricData);
variance = getMetricVariance(metricData);
} | java | {
"resource": ""
} |
q163677 | AnomalyDetectionGaussianTransform.predictAnomalies | train | private Metric predictAnomalies(Map<Long, Double> metricData) {
Metric predictions = new Metric(getResultScopeName(), getResultMetricName());
Map<Long, Double> predictionDatapoints = new HashMap<>();
if (variance == 0.0) {
/**
* If variance is 0, there are no anomalies.... | java | {
"resource": ""
} |
q163678 | DefaultWardenService._constructWardenAlertForUser | train | private Alert _constructWardenAlertForUser(PrincipalUser user, PolicyCounter counter) {
String metricExp = _constructWardenMetricExpression("-1h", user, counter);
Alert alert = new Alert(_adminUser, _adminUser, _constructWardenAlertName(user, counter), metricExp, "*/5 * * * *");
List<Trigger> tr... | java | {
"resource": ""
} |
q163679 | DefaultWardenService._startScheduledExecutorService | train | private void _startScheduledExecutorService() {
DisableWardenAlertsThread disableWardenAlertThread = new DisableWardenAlertsThread();
_scheduledExecutorService.scheduleAtFixedRate(disableWardenAlertThread, 0L, TIME_BETWEEN_WARDEN_ALERT_DISABLEMENT_MILLIS,
TimeUnit.MILLISECONDS);
} | java | {
"resource": ""
} |
q163680 | DefaultWardenService._shutdownScheduledExecutorService | train | private void _shutdownScheduledExecutorService() {
_logger.info("Shutting down scheduled disable warden alerts executor service");
_scheduledExecutorService.shutdown();
try {
if (!_scheduledExecutorService.awaitTermination(5, TimeUnit.SECONDS)) {
_logger.warn("Shutdow... | java | {
"resource": ""
} |
q163681 | GOCNotifier._sendAdditionalNotification | train | protected void _sendAdditionalNotification(NotificationContext context, NotificationStatus status) {
requireArgument(context != null, "Notification context cannot be null.");
if(status == NotificationStatus.TRIGGERED) {
super.sendAdditionalNotification(context);
}else {
super.clearAdditionalNotificati... | java | {
"resource": ""
} |
q163682 | JPAEntity.findByPrimaryKey | train | public static <E extends Identifiable> E findByPrimaryKey(EntityManager em, BigInteger id, Class<E> type) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(id != null && id.compareTo(ZERO) > 0, "ID cannot be null and must be positive and non-zero");
requireArgu... | java | {
"resource": ""
} |
q163683 | JPAEntity.findByPrimaryKeys | train | public static <E extends Identifiable> List<E> findByPrimaryKeys(EntityManager em, List<BigInteger> ids, Class<E> type) {
requireArgument(em != null, "The entity manager cannot be null.");
requireArgument(ids != null && !ids.isEmpty(), "IDs cannot be null or empty.");
requireArgument(type != nul... | java | {
"resource": ""
} |
q163684 | JPAEntity.findEntitiesMarkedForDeletion | train | public static <E extends Identifiable> List<E> findEntitiesMarkedForDeletion(EntityManager em, Class<E> type, final int limit) {
requireArgument(em != null, "Entity Manager cannot be null");
requireArgument(limit == -1 || limit > 0, "Limit if not -1, must be greater than 0.");
TypedQuery<E> que... | java | {
"resource": ""
} |
q163685 | AnnotationService.putAnnotations | train | public PutResult putAnnotations(List<Annotation> annotations) throws IOException, TokenExpiredException {
String requestUrl = COLLECTION_RESOURCE + RESOURCE;
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.POST, requestUrl, annotations);
assertValidResponse(r... | java | {
"resource": ""
} |
q163686 | DownsampleTransform.downsamplerReducer | train | public static Double downsamplerReducer(List<Double> values, String reducerType) {
List<Double> operands = new ArrayList<Double>();
for (Double value : values) {
if (value == null) {
operands.add(0.0);
} else {
operands.add(value);
}
}
InternalReducerType type = InternalReducerType.fromString... | java | {
"resource": ""
} |
q163687 | AuthFilter.doFilter | train | @Override
public void doFilter(ServletRequest request, ServletResponse response, FilterChain chain) throws IOException, ServletException {
String user = null;
if (HttpServletRequest.class.isAssignableFrom(request.getClass())) {
HttpServletRequest req = HttpServletRequest.class... | java | {
"resource": ""
} |
q163688 | SubsystemSuspensionLevels.findBySubsystem | train | public static SubsystemSuspensionLevels findBySubsystem(EntityManager em, SubSystem subSystem) {
SystemAssert.requireArgument(em != null, "Entity manager can not be null.");
SystemAssert.requireArgument(subSystem != null, "Subsystem cannot be null.");
TypedQuery<SubsystemSuspensionLevels> query... | java | {
"resource": ""
} |
q163689 | SubsystemSuspensionLevels.getSuspensionLevelsBySubsystem | train | public static Map<Integer, Long> getSuspensionLevelsBySubsystem(EntityManager em, SubSystem subSystem) {
return findBySubsystem(em, subSystem).getLevels();
} | java | {
"resource": ""
} |
q163690 | SubsystemSuspensionLevels.setLevels | train | public void setLevels(Map<Integer, Long> levels) {
SystemAssert.requireArgument(levels != null, "Levels cannot be null");
this.levels.clear();
this.levels.putAll(levels);
} | java | {
"resource": ""
} |
q163691 | SystemMain.getInstance | train | public static SystemMain getInstance(Properties config) {
return Guice.createInjector(new SystemInitializer(config)).getInstance(SystemMain.class);
} | java | {
"resource": ""
} |
q163692 | SystemMain.doStart | train | @Override
protected void doStart() {
try {
String build = _configuration.getValue(SystemConfiguration.Property.BUILD);
String version = _configuration.getValue(SystemConfiguration.Property.VERSION);
String year = new SimpleDateFormat("yyyy").format(new Date());
... | java | {
"resource": ""
} |
q163693 | SystemMain.doStop | train | @Override
protected void doStop() {
try {
_dispose(_serviceFactory.getWardenService());
_dispose(_serviceFactory.getMonitorService());
_dispose(_serviceFactory.getSchedulingService());
_dispose(_serviceFactory.getGlobalInterlockService());
_dispose... | java | {
"resource": ""
} |
q163694 | MetricDto.transformToDto | train | public static MetricDto transformToDto(Metric metric) {
if (metric == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
MetricDto result = createDtoObject(MetricDto.class, metric);
return resu... | java | {
"resource": ""
} |
q163695 | HBaseUtils._9sComplement | train | public static long _9sComplement(long creationTime) {
String time = String.valueOf(creationTime);
char[] timeArr = time.toCharArray();
StringBuilder sb = new StringBuilder();
for(char c : timeArr) {
sb.append(9 - Character.getNumericValue(c));
}
return Long.parseLong(sb.toString());
} | java | {
"resource": ""
} |
q163696 | DashboardService.getDashboard | train | public Dashboard getDashboard(BigInteger dashboardId) throws IOException, TokenExpiredException {
String requestUrl = RESOURCE + "/" + dashboardId.toString();
ArgusResponse response = getClient().executeHttpRequest(ArgusHttpClient.RequestType.GET, requestUrl, null);
assertValidResponse(response... | java | {
"resource": ""
} |
q163697 | MetricFilterWithInteralReducerTransform.internalReducer | train | public static String internalReducer(Metric metric, String reducerType) {
Map<Long, Double> sortedDatapoints = new TreeMap<>();
List<Double> operands = new ArrayList<Double>();
if(!reducerType.equals(InternalReducerType.NAME.getName())) {
if(metric.getDatapoints()!=null && metric.getDatapoints().size()>0) {
... | java | {
"resource": ""
} |
q163698 | MetricFilterWithInteralReducerTransform.sortByValue | train | public static Map<Metric, String> sortByValue(Map<Metric, String> map, final String reducerType) {
List<Map.Entry<Metric, String>> list = new LinkedList<>(map.entrySet());
Collections.sort(list, new Comparator<Map.Entry<Metric, String>>() {
@Override
public int compare(Map.Entry<Metric, String> o1, Map.Entr... | java | {
"resource": ""
} |
q163699 | NotificationDto.transformToDto | train | public static NotificationDto transformToDto(Notification notification) {
if (notification == null) {
throw new WebApplicationException("Null entity object cannot be converted to Dto object.", Status.INTERNAL_SERVER_ERROR);
}
NotificationDto result = createDtoObject(NotificationDto.... | java | {
"resource": ""
} |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.