code
stringlengths
73
34.1k
label
stringclasses
1 value
Observable<ComapiResult<MessagesQueryResponse>> processOrphanedEvents(ComapiResult<MessagesQueryResponse> result, final ChatController.OrphanedEventsToRemoveListener removeListener) { if (result.isSuccessful() && result.getResult() != null) { final MessagesQueryResponse response = result.getResult...
java
public Observable<Boolean> updateStoreWithNewMessage(final ChatMessage message, final ChatController.NoConversationListener noConversationListener) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { ...
java
public Observable<Boolean> updateStoreForSentError(String conversationId, String tempId, String profileId) { return asObservable(new Executor<Boolean>() { @Override protected void execute(ChatStore store, Emitter<Boolean> emitter) { store.beginTransaction(); ...
java
private boolean doUpdateConversationFromEvent(ChatStore store, String conversationId, Long eventId, Long updatedOn) { ChatConversationBase conversation = store.getConversation(conversationId); if (conversation != null) { ChatConversationBase.Builder builder = ChatConversationBase.baseBuil...
java
public Observable<Boolean> upsertConversation(ChatConversation conversation) { List<ChatConversation> conversations = new ArrayList<>(); conversations.add(conversation); return upsertConversations(conversations); }
java
private <T> Observable<T> asObservable(Executor<T> transaction) { return Observable.create(emitter -> storeFactory.execute(new StoreTransaction<ChatStore>() { @Override protected void execute(ChatStore store) { try { transaction.execute(store, emitter)...
java
@Override public void setCharset(Charset cs, boolean fixedCharset) { if (includeLevel.in instanceof ModifiableCharset) { ModifiableCharset sr = (ModifiableCharset) includeLevel.in; sr.setCharset(cs, fixedCharset); } else { throw new Uns...
java
@Override public void release() throws IOException { if (includeLevel.in != null && end != cursor) { if (end % size < cursor % size) { buffer2.position(0); buffer2.limit((int)(end % size)); buffer1.position((int)(cursor % si...
java
@Override public int peek(int offset) throws IOException { long target = cursor + offset - 1; if (target - end > size || target < end - size || target < 0) { throw new IllegalArgumentException("offset "+offset+" out of buffer"); } if (target >= end) { ...
java
@Override public void rewind(int count) throws IOException { if (count < 0) { throw new IllegalArgumentException("negative rewind "+count); } cursor -= count; if (cursor < end - size || cursor < 0) { throw new IOException("insufficient room...
java
@Override public final int read() throws IOException { assert cursor <= end; if (cursor >= end) { if (includeLevel.in == null) { return -1; } int cp = (int)(cursor % size); long len = size-(cursor-waterMark); ...
java
@Override public int parseInt(long s, int l, int radix) { return Primitives.parseInt(getCharSequence(s, l), radix); }
java
@GET public Response compile(@QueryParam("type") final String _type) { boolean success = false; try { if (hasAccess()) { AbstractRest.LOG.info("===Starting Compiler via REST==="); if ("java".equalsIgnoreCase(_type)) { AbstractRest.L...
java
@Override public void supplierChanged(SupplierEvent supplierEvent) { SupplierEvent.Type type = supplierEvent.type(); @SuppressWarnings("unchecked") Supplier<T> supplier = (Supplier<T>) supplierEvent.supplier(); switch (type) { case ADD: if (supplierReferen...
java
private String getLabel(final UIValue _uiValue, final Boolean _key) throws CacheReloadException { String ret = BooleanUtils.toStringTrueFalse(_key); if (_uiValue.getAttribute() != null && DBProperties.hasProperty(_uiValue.getAttribute().get...
java
public void addObject(final Object[] _row) throws SQLException { // store the ids also this.idList.add((Long) _row[0]); if (getFromSelect() != null) { final int column = "id".equals(this.valueSelect.getValueType()) ? this.valueSelect.getColInd...
java
public void addFileSelectPart() throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size(...
java
public void addGenInstSelectPart() throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.si...
java
public void addAttributeSetSelectPart(final String _attributeSet, final String _where) throws EFapsException { final Type type; // if a previous select exists it is based on the previous select, // else it is based on the basic table ...
java
public void append2SQLFrom(final SQLSelect _select) throws EFapsException { // for attributes it must be evaluated if the attribute is inside a child table if (this.valueSelect != null && "attribute".equals(this.valueSelect.getValueType())) { final Type type; if (this...
java
public int append2SQLSelect(final SQLSelect _select, final int _colIndex) throws EFapsException { final Type type; if (this.selectParts.size() > 0) { type = this.selectParts.get(this.selectParts.size() - 1).getType(); } else { t...
java
public void append2SQLWhere(final SQLSelect _select) throws EFapsException { for (final ISelectPart part : this.selectParts) { part.add2Where(this, _select); } }
java
private Object getObject(final Object _object) throws EFapsException { final Object ret; // inside a fromobject the correct value must be set if (this.fromSelect != null && _object instanceof Number) { final List<Object> tmpList = new ArrayList<>(); final Long...
java
public Object getObject() throws EFapsException { Object ret = null; if (this.valueSelect == null) { // if the fromSelect has data if (this.fromSelect.hasResult()) { // and there are more than one id the current object must not be null ...
java
@SuppressWarnings("unchecked") public List<Instance> getInstances() throws EFapsException { final List<Instance> ret = new ArrayList<>(); // no value select means, that the from select must be asked if (this.valueSelect == null) { ret.addAll(this.fromSelect.getMainOne...
java
public void sortByInstanceList(final List<Instance> _targetList, final Map<Instance, Integer> _currentList) { final List<Long> idListNew = new ArrayList<>(); final List<Object> objectListNew = new ArrayList<>(); for (final Instance instance : _targetList) {...
java
public Long createTask(String taskName, String data) { return tedDriverImpl.createTask(taskName, data, null, null, null); }
java
public Long createBatch(String batchTaskName, String data, String key1, String key2, List<TedTask> tedTasks) { return tedDriverImpl.createBatch(batchTaskName, data, key1, key2, tedTasks); }
java
public Long createEvent(String taskName, String queueId, String data, String key2) { return tedDriverImpl.createEvent(taskName, queueId, data, key2); }
java
public Long createEventAndTryExecute(String taskName, String queueId, String data, String key2) { return tedDriverImpl.createEventAndTryExecute(taskName, queueId, data, key2); }
java
public Long sendNotification(String taskName, String data) { return tedDriverImpl.sendNotification(taskName, data); }
java
public void set(double x, double y, double r, double radStart, double radEnd) { this.x = x; this.y = y; this.w = r * 2; this.h = r * 2; this.radStart = radStart; this.radEnd = radEnd; }
java
public void setCenterColor(ColorSet colorSet) { if (this.centerColor == null) { this.centerColor = new RGBColor(0.0, 0.0, 0.0); } setGradation(true); this.centerColor = RGBColor.color(colorSet); }
java
public void setEdgeColor(Color color) { if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0); setGradation(true); this.edgeColor = color; }
java
public void setEdgeColor(ColorSet colorSet) { if (edgeColor == null) edgeColor = new RGBColor(0.0, 0.0, 0.0); setGradation(true); this.edgeColor = RGBColor.color(colorSet); }
java
private void addSubDimension(final Facets _facets, final DimValue _dimValue, final String _dim, final String _path) throws IOException { final FacetResult result = _facets.getTopChildren(1000, _dim, _p...
java
private void checkAccess() throws EFapsException { // check the access for the given instances final Map<Instance, Boolean> accessmap = new HashMap<Instance, Boolean>(); for (final Entry<Type, List<Instance>> entry : this.typeMapping.entrySet()) { accessmap.putAll(entry.g...
java
protected void recordMetricsForPool(final MemoryPoolMXBean pool, final Metrics metrics) { final MemoryUsage usage = pool.getUsage(); metrics.setGauge( String.join( "/", ROOT_NAMESPACE, memoryTypeSegment(pool.getType(...
java
public void setNode(int number, double x, double y) { if (number <= 0) number = 0; if (number >= 3) number = 3; this.points[number * 3] = (float)x; this.points[number * 3 + 1] = (float)y; this.points[number * 3 + 2] = 0; set(); }
java
public void setNode(int number, Vector3D v) { if (number <= 0) { number = 0; } else if (3 <= number) { number = 3; } this.points[number * 3] = (float)v.getX(); this.points[number * 3 + 1] = (float)v.getY(); this.points[number * 3 + 2] = (float)v.ge...
java
public double curvePoint(XYZ vec, float t) { double tmp = 0; switch (vec) { case X: tmp = catmullRom(points[0], points[3], points[6], points[9], t); break; case Y: tmp = catmullRom(points[1], points[4], points[7], points[10], t); break; ...
java
@SuppressWarnings("unchecked") public <T> T getAttribute(final Attribute _attribute) throws EFapsException { return (T) getAttribute(_attribute.getName()); }
java
public AbstractPrintQuery addAttributeSet(final String _setName) throws EFapsException { final Type type = getMainType(); if (type != null) { final AttributeSet set = AttributeSet.find(type.getName(), _setName); addAttributeSet(set); } return this; ...
java
public AbstractPrintQuery addAttributeSet(final AttributeSet _set) throws EFapsException { final String key = "linkfrom[" + _set.getName() + "#" + _set.getAttributeName() + "]"; final OneSelect oneselect = new OneSelect(this, key); this.allSelects.add(oneselect); this.attr2On...
java
@SuppressWarnings("unchecked") public <T> T getAttributeSet(final String _setName) throws EFapsException { final OneSelect oneselect = this.attr2OneSelect.get(_setName); Map<String, Object> ret = null; if (oneselect == null || oneselect.getFromSelect() == null) { Abst...
java
public Attribute getAttribute4Select(final String _selectStmt) { final OneSelect oneselect = this.selectStmt2OneSelect.get(_selectStmt); return oneselect == null ? null : oneselect.getAttribute(); }
java
public List<Instance> getInstances4Select(final String _selectStmt) throws EFapsException { final OneSelect oneselect = this.selectStmt2OneSelect.get(_selectStmt); return oneselect == null ? new ArrayList<>() : oneselect.getInstances(); }
java
public boolean isList4Select(final String _selectStmt) throws EFapsException { final OneSelect oneselect = this.selectStmt2OneSelect.get(_selectStmt); return oneselect == null ? false : oneselect.isMultiple(); }
java
public Integer getNewTableIndex(final String _tableName, final String _column, final Integer _relIndex, final Long _clazzId) { this.tableIndex++; this.sqlTable2Index.put(_relIndex + "__" + _ta...
java
@Override public void generate(final Module module, final Element parent) { final AppModule m = (AppModule) module; if (m.getDraft() != null) { final String draft = m.getDraft().booleanValue() ? "yes" : "no"; final Element control = new Element("control", APP_NS); ...
java
public void setCursor(CursorMode cursorMode) { Cursor c = CursorMode.getAWTCursor(cursorMode); if (c.getType() == panel.getCursor().getType()) return; panel.setCursor(c); }
java
public static Key get4Instance(final Instance _instance) throws EFapsException { Key.LOG.debug("Retrieving Key for {}", _instance); final Key ret = new Key(); ret.setPersonId(Context.getThreadContext().getPersonId()); final Type type = _instance.getType(); ret.setTyp...
java
public T execute() throws ApiException, IOException { return client.executeRequest(this.builder, expectedCode, responseClass, needAuth); }
java
public Future<T> executeAsync(final RestCallback<T> handler) { return client.submit(new Callable<T>() { @Override public T call() throws Exception { try { final T result = execute(); handler.completed(result, RestRequest.this); ...
java
public Future<T> executeAsync() { return client.submit(new Callable<T>() { @Override public T call() throws Exception { return execute(); } }); }
java
public static Image getTypeIcon(final Type _type) throws EFapsException { Image ret = null; if (_type != null) { ret = _type.getTypeIcon(); } return ret; }
java
protected void addAlwaysUpdateAttributes() throws EFapsException { final Iterator<?> iter = getInstance().getType().getAttributes().entrySet().iterator(); while (iter.hasNext()) { final Map.Entry<?, ?> entry = (Map.Entry<?, ?>) iter.next(); final Attribute attr = (Att...
java
public void executeWithoutTrigger() throws EFapsException { if (Update.STATUSOK.getStati().isEmpty()) { final Context context = Context.getThreadContext(); ConnectionResource con = null; try { con = context.getConnectionResource(); ...
java
public boolean updateSearchFunctionIfNecessary(CouchDbConnector db, String viewName, String searchFunction, String javascriptIndexFunctionBody) { boolean updatePerformed = false; String designDocName = viewName.startsWith(DesignDocument.ID_PREFIX) ...
java
private void updateSearchFunction(CouchDbConnector db, DesignDocument doc, String searchFunctionName, String javascript, long jsChecksum) { // get the 'fulltext' object from the design document, this is what couchdb-lucene uses to index couch Map<String, Map<String...
java
public void connect() throws Exception { logger.debug("[connect] initializing new connection"); synchronized (webSocketHandler.getNotifyConnectionObject()) { webSocketConnectionManager.start(); try { webSocketHandler.getNotifyConnectionObject().wait(TimeUnit.SEC...
java
public boolean isUsable() { return isConnected() && TimeUnit.MILLISECONDS.toMinutes(new Date().getTime() - lastUsage.getTime()) <= MAXIMUM_AGE_IN_MINUTES; }
java
public void add(long timestamp, String column, Object value) { if (!(value instanceof Long) && !(value instanceof Integer) && !(value instanceof Double) && !(value instanceof Float) && !(value instanceof Boolean) && !(value instanceof String)) { throw new IllegalArgumentExcep...
java
public void add(String column, Object value) { add(System.currentTimeMillis(), column, value); }
java
public void add(String[] columns, Object[] values) { add(System.currentTimeMillis(), columns, values); }
java
public void add(long timestamp, Map<String, Object> data) { for (String k : data.keySet()) { if (!columns.contains(k)) { throw new UnknownFieldException(k); } } Map<String, Object> curr = this.rows.get(timestamp); if (curr == null) { t...
java
public void merge(DataStore other) { if (!this.hasSameColumns(other)) { throw new IllegalArgumentException("DataStore must have the same columns to merge"); } this.rows.putAll(other.rows); }
java
public TreeMap<Long, Map<String, Object>> getRows() { return new TreeMap<Long, Map<String, Object>>(this.rows); }
java
public boolean hasColumns(Collection<String> columns) { return columns != null && this.columns.equals(new TreeSet<String>(columns)); }
java
public static DataStore fromJson(final JSONObject json) throws ParseException { DataStore ret; JSONArray jsonCols = json.getJSONArray("fields"); if (!"time".equals(jsonCols.get(0))) { throw new JSONException("time must be the first item in 'fields'"); } Set<String> ...
java
public JSONObject toJson() { JSONObject ret = new JSONObject(); JSONArray columns = new JSONArray(Arrays.asList(new String[]{"time"})); for (String f : this.columns) { columns.put(f); } ret.put(KEY_COLUMNS, columns); JSONArray data = new JSONArray(); ...
java
public void add(final Field _field) { this.fields.put(_field.getId(), _field); this.fieldName2Field.put(_field.getName(), _field); if (_field.getReference() != null && _field.getReference().length() > 0) { final String ref = _field.getReference(); int index; ...
java
protected int addFieldExpr(final String _expr) { int ret = -1; if (getAllFieldExpr().containsKey(_expr)) { ret = getFieldExprIndex(_expr); } else { getAllFieldExpr().put(_expr, Integer.valueOf(getSelIndexLen())); if (getSelect() == null) { ...
java
private void readFromDB4Fields() throws CacheReloadException { try { final QueryBuilder queryBldr = new QueryBuilder(CIAdminUserInterface.Field); queryBldr.addWhereAttrEqValue(CIAdminUserInterface.Field.Collection, getId()); final MultiPrintQuery multi = queryBld...
java
@Path("setCompany") @GET @Produces({ MediaType.APPLICATION_JSON, MediaType.TEXT_PLAIN }) @SuppressWarnings("checkstyle:illegalcatch") public Response setCompany(@QueryParam("company") final String _companyStr) { try { final Company company; if (UUIDUtil.isUUID(_compan...
java
public synchronized void onServerAvailable(final String id, final String role) { logger.debug("[onServerAvailable] id = {}, role = {}", id, role); Server server = getServerById(id); boolean isMaster = role.equals("master"); boolean isSlave = role.equals("slave"); if (server == ...
java
public synchronized void onServerUnavailable(final String id) { logger.debug("[onServerUnavailable] id = {}", id); Server server = getServerById(id); if (server != null) { server.setAvailable(false); refreshServers(); } }
java
public synchronized void onServerReconnected(final String id, final String uri) { logger.debug("[onServerReconnected] id = {}, uri = {}", id, uri); if (id.length() == 0) { Server server = getServerByUri(uri); server.register(); server.setAvailable(true); } ...
java
protected Server getReadServer() { Server[] servers = readServers; return servers[readSequence.incrementAndGet(servers.length)]; }
java
@Override public int[] calculateInDegrees() { final int[] in_degrees = new int[size()]; for(int i = 0; i < size(); ++i) { final IAdjacencyListPair<TVertex> p = pairAt(i); final TVertex d = p.getVertex(); for(int j = 0; j < size(); ++j) { for(IVertex dep : pairAt(j).getOutNeighbors()...
java
@Override public void afterConnectionEstablished(final WebSocketSession webSocketSession) { logger.debug("[afterConnectionEstablished] id = {}", webSocketSession.getId()); this.session = webSocketSession; synchronized (notifyConnectionObject) { notifyConnectionObject.notifyAll()...
java
@Override public void afterConnectionClosed(final WebSocketSession webSocketSession, final CloseStatus status) { logger.debug("[afterConnectionClosed] id = ", webSocketSession.getId()); this.session = null; if (connectionListener != null) { connectionListener.onConnectionClosed(...
java
@Override public void handleTransportError(final WebSocketSession webSocketSession, final Throwable exception) throws Exception { if (exception != null) { logger.error("[handleTransportError]", exception); } }
java
public void sendMessage(final String message) { try { session.sendMessage(new TextMessage(message)); } catch (IOException e) { logger.error("[sendTextMessage]", e); } }
java
public void sendMessage(final byte[] message) { try { session.sendMessage(new BinaryMessage(message)); } catch (IOException e) { logger.error("[sendBinaryMessage]", e); } }
java
public Resource getStoreResource(final Instance _instance, final Resource.StoreEvent _event) throws EFapsException { Resource storeRsrc = null; final Store store = Store.get(_instance.getType().getStoreId()); storeRsrc = store.getResource(_instanc...
java
public String getParameter(final String _key) { String value = null; if (this.parameters != null) { final String[] values = this.parameters.get(_key); if (values != null && values.length > 0) { value = values[0]; } } return value; ...
java
public Object setRequestAttribute(final String _key, final Object _value) { return this.requestAttributes.put(_key, _value); }
java
public Object setSessionAttribute(final String _key, final Object _value) { return this.sessionAttributes.put(_key, _value); }
java
public UserAttributesSet getUserAttributes() throws EFapsException { if (containsSessionAttribute(UserAttributesSet.CONTEXTMAPKEY)) { return (UserAttributesSet) getSessionAttribute(UserAttributesSet.CONTEXTMAPKEY); } else { throw new EFapsException(Context.class, "get...
java
public void setCompany(final Company _company) throws CacheReloadException { if (_company == null) { this.companyId = null; } else { this.companyId = _company.getId(); } }
java
public static Context getThreadContext() throws EFapsException { Context context = Context.THREADCONTEXT.get(); if (context == null) { context = Context.INHERITTHREADCONTEXT.get(); } if (context == null) { throw new EFapsException(Context.class, "getTh...
java
public static void save() throws EFapsException { try { Context.TRANSMANAG.commit(); Context.TRANSMANAG.begin(); final Context context = Context.getThreadContext(); context.connectionResource = null; context.setTransaction(Context.TRANSMANA...
java
public static boolean isTMActive() throws EFapsException { try { return Context.TRANSMANAG.getStatus() == Status.STATUS_ACTIVE; } catch (final SystemException e) { throw new EFapsException(Context.class, "isTMActive.SystemException", e); } }
java
public static boolean isTMNoTransaction() throws EFapsException { try { return Context.TRANSMANAG.getStatus() == Status.STATUS_NO_TRANSACTION; } catch (final SystemException e) { throw new EFapsException(Context.class, "isTMNoTransaction.SystemException", e); ...
java
public static boolean isTMMarkedRollback() throws EFapsException { try { return Context.TRANSMANAG.getStatus() == Status.STATUS_MARKED_ROLLBACK; } catch (final SystemException e) { throw new EFapsException(Context.class, "isTMMarkedRollback.SystemException", e); ...
java
public static void reset() throws StartupException { try { final InitialContext initCtx = new InitialContext(); final javax.naming.Context envCtx = (javax.naming.Context) initCtx.lookup("java:comp/env"); Context.DBTYPE = (AbstractDatabase<?>) envCtx.lookup(INaming...
java
public boolean execute(final OneSelect _onesel) throws EFapsException { this.hasResult = executeOneCompleteStmt(createSQLStatement(_onesel), getAllSelects()); if (this.hasResult) { for (final OneSelect onesel : getAllSelects()) { if (onesel.getFromSelect() != nul...
java
private List<Type> getAllChildTypes(final Type _parent) throws CacheReloadException { final List<Type> ret = new ArrayList<>(); for (final Type child : _parent.getChildTypes()) { ret.addAll(getAllChildTypes(child)); ret.add(child); } return ret; }
java
public static JasperDesign getJasperDesign(final Instance _instance) throws EFapsException { final Checkout checkout = new Checkout(_instance); final InputStream source = checkout.execute(); JasperDesign jasperDesign = null; try { JasperUtil.LOG.debug("Loading Jas...
java