conversation
listlengths
2
2
[ { "content": "Create a crud against the specified table that will validate on the first interaction with a connection.\n@param table the table name\n@return a new crud instance", "role": "user" }, { "content": "public Crud<T, K> table(String table) {\n return new LazyCrud<T, K>(this, table);\...
[ { "content": "Create a crud against the specified table validating it against the specified connection.\n@param connection the connection\n@param table the table\n@return a new crud instance\n@throws SQLException if an error occurred", "role": "user" }, { "content": "public Crud<T, K> table(Connecti...
[ { "content": "Create a connected crud against the specified table validating it against the specified datasource.\n@param dataSource the datasource\n@param table the table\n@return a new crud instance\n@throws SQLException if an error occurred", "role": "user" }, { "content": "public ConnectedCrud<T...
[ { "content": "Create a connected crud validating it against the specified datasource.\nThe table name is derived from the jpa annotation or from the class name.\n@param dataSource the datasource\n@return a new crud instance\n@throws SQLException if an error occurred", "role": "user" }, { "content": ...
[ { "content": "Create a connected crud validating it against the specified connection.\nThe table name is derived from the jpa annotation or from the class name.\n@param connection the connection\n@return a new crud instance\n@throws SQLException if an error occurred", "role": "user" }, { "content": ...
[ { "content": "Precompute the values necessary for the ray slope algorithm.", "role": "user" }, { "content": "private void precomputeSlope() {\n float invDirX = 1.0f / dirX;\n float invDirY = 1.0f / dirY;\n float invDirZ = 1.0f / dirZ;\n s_yx = dirX * invDirY;\n s_x...
[ { "content": "Set this quaternion to represent a rotation of the given radians about the x axis.\n\n@param angle\nthe angle in radians to rotate about the x axis\n@return this", "role": "user" }, { "content": "public Quaterniond rotationX(double angle) {\n double sin = Math.sin(angle * 0.5);\...
[ { "content": "Divide this Vector3f component-wise by another Vector3fc.\n\n@param v\nthe vector to divide by\n@return a vector holding the result", "role": "user" }, { "content": "public Vector3f div(Vector3fc v) {\n return div(v.x(), v.y(), v.z(), thisOrNew());\n }", "role": "assistan...
[ { "content": "Normalize this quaternion.\n\n@return this", "role": "user" }, { "content": "public Quaternionf normalize() {\n float invNorm = (float) (1.0 / Math.sqrt(x * x + y * y + z * z + w * w));\n x *= invNorm;\n y *= invNorm;\n z *= invNorm;\n w *= invNorm;\n...
[ { "content": "Set the matrix element at the given column and row to the specified value.\n\n@param column\nthe colum index in <code>[0..2]</code>\n@param row\nthe row index in <code>[0..2]</code>\n@param value\nthe value\n@return this", "role": "user" }, { "content": "public Matrix3d set(int column,...
[ { "content": "Ensure that the minimum coordinates are strictly less than or equal to the maximum coordinates by swapping\nthem if necessary.\n\n@return this", "role": "user" }, { "content": "public AABBd correctBounds() {\n double tmp;\n if (this.minX > this.maxX) {\n tmp = ...
[ { "content": "Add the supplied vector to this one.\n\n@param v\nthe vector to add\n@return a vector holding the result", "role": "user" }, { "content": "public Vector3i add(Vector3ic v) {\n return add(v.x(), v.y(), v.z(), thisOrNew());\n }", "role": "assistant" } ]
[ { "content": "Multiply the components of this vector by the given values.\n\n@param x\nthe x component to multiply\n@param y\nthe y component to multiply\n@param z\nthe z component to multiply\n@return a vector holding the result", "role": "user" }, { "content": "public Vector3i mul(int x, int y, in...
[ { "content": "Get the length squared of a 3-dimensional double-precision vector.\n\n@param x The vector's x component\n@param y The vector's y component\n@param z The vector's z component\n\n@return the length squared of the given vector\n\n@author F. Neurath", "role": "user" }, { "content": "public...
[ { "content": "Get the length of a 4-dimensional single-precision vector.\n\n@param x The vector's x component\n@param y The vector's y component\n@param z The vector's z component\n@param w The vector's w component\n\n@return the length squared of the given vector", "role": "user" }, { "content": "p...
[ { "content": "If activity is run to back stack. So we have to check if this activity is resume working.", "role": "user" }, { "content": "public void onResume(final Context context) {\n new Handler().post(new Runnable() {\n @Override\n public void run() {\n ...
[ { "content": "Provide method to set application language by country name.", "role": "user" }, { "content": "public final void setLanguage(Context context, String language) {\n Locale locale = new Locale(language);\n setLanguage(context, locale);\n }", "role": "assistant" } ]
[ { "content": "If yes, bundle will obe remove and set boolean flag to \"true\".", "role": "user" }, { "content": "private void checkBeforeLocaleChanging() {\n boolean isLocalizationChanged = activity.getIntent().getBooleanExtra(KEY_ACTIVITY_LOCALE_CHANGED, false);\n if (isLocalizationCh...
[ { "content": "This method will called before onCreate.", "role": "user" }, { "content": "private void setupLanguage() {\n Locale locale = LanguageSetting.getLanguage(activity);\n setupLocale(locale);\n currentLanguage = locale;\n LanguageSetting.setLanguage(activity, loca...
[ { "content": "Avoid duplicated setup", "role": "user" }, { "content": "private boolean isCurrentLanguageSetting(Context context, Locale locale) {\n return locale.toString().equals(LanguageSetting.getLanguage(context).toString());\n }", "role": "assistant" } ]
[ { "content": "Let's take it change! (Using recreate method that available on API 11 or more.", "role": "user" }, { "content": "private void notifyLanguageChanged() {\n sendOnBeforeLocaleChangedEvent();\n activity.getIntent().putExtra(KEY_ACTIVITY_LOCALE_CHANGED, true);\n callDum...
[ { "content": "Check if locale has change while this activity was run to back stack.", "role": "user" }, { "content": "private void checkLocaleChange(Context context) {\n if (!isCurrentLanguageSetting(context, currentLanguage)) {\n sendOnBeforeLocaleChangedEvent();\n isLo...
[ { "content": "Scans a list of resources returning all AsciiDoc documents found.\n\n@param resources List of {@link Resource} to scan (the directory property is mandatory)\n@return List of found documents matching the resources properties", "role": "user" }, { "content": "public List<File> scan(List<...
[ { "content": "Returns LogRecords that are equal or above the severity level.\n\n@param severity Asciidoctor severity level\n@return list of filtered logRecords", "role": "user" }, { "content": "public List<LogRecord> filter(Severity severity) {\n // FIXME: find better name or replace with str...
[ { "content": "Returns LogRecords whose message contains text.\n\n@param text text to search for in the LogRecords\n@return list of filtered logRecords", "role": "user" }, { "content": "public List<LogRecord> filter(String text) {\n final List<LogRecord> records = new ArrayList<>();\n f...
[ { "content": "Returns LogRecords that are equal or above the severity level and whose message contains text.\n\n@param severity Asciidoctor severity level\n@param text text to search for in the LogRecords\n@return list of filtered logRecords", "role": "user" }, { "content": "public List<LogRecor...
[ { "content": "Attaches the SwipeBack to the Activity\n\n@param activity\n@param type\n@param position\n@param dragMode\nThe dragMode which is {@link #DRAG_CONTENT} or\n{@link #DRAG_WINDOW}\n@return The created SwipeBack instance", "role": "user" }, { "content": "public static SwipeBack attach(Activi...
[ { "content": "Constructs the appropriate SwipeBack based on the position.", "role": "user" }, { "content": "private static SwipeBack createSwipeBack(Activity activity, int dragMode, Position position, Type type, SwipeBackTransformer transformer) {\n\n\t\tSwipeBack drawerHelper;\n\n\t\tif (type == Ty...
[ { "content": "Determines if the activity has been destroyed or finished. This is useful\nto dertermine if a\n\n@return", "role": "user" }, { "content": "@SuppressLint(\"NewApi\")\n\tprotected boolean isActivitiyDestroyed() {\n\n\t\tif (Build.VERSION.SDK_INT >= Build.VERSION_CODES.JELLY_BEAN_MR1) {\n...
[ { "content": "Attaches the swipe back to the content view.", "role": "user" }, { "content": "private static void attachToContent(Activity activity, SwipeBack swipeBack) {\n\t\t/**\n\t\t * Do not call mActivity#setContentView.\n\t\t * E.g. if using with a ListActivity, Activity#setContentView is over...
[ { "content": "Attaches the swipe back drawer to the window.", "role": "user" }, { "content": "private static void attachToDecor(Activity activity, SwipeBack swipeBack) {\n\t\tViewGroup decorView = (ViewGroup) activity.getWindow().getDecorView();\n\t\tViewGroup decorChild = (ViewGroup) decorView.getC...
[ { "content": "Compute the touch area based on the touch mode.", "role": "user" }, { "content": "protected void updateTouchAreaSize() {\n\t\tif (mTouchMode == TOUCH_MODE_BEZEL) {\n\t\t\tmTouchSize = mTouchBezelSize;\n\t\t} else if (mTouchMode == TOUCH_MODE_FULLSCREEN) {\n\t\t\tmTouchSize = getMeasure...
[ { "content": "Sets the color of the divider, if you have set the option to use a shadow\ngradient as divider\n\nYou must enable the divider by calling\n{@link #setDividerEnabled(boolean)}\n\n@param color\nThe color of the divider shadow.", "role": "user" }, { "content": "public SwipeBack setDividerA...
[ { "content": "Set the swipe back view from a layout resource.\n\n@param layoutResId\nResource ID to be inflated.", "role": "user" }, { "content": "public SwipeBack setSwipeBackView(int layoutResId) {\n\t\tmSwipeBackContainer.removeAllViews();\n\t\tmSwipeBackView = LayoutInflater.from(getContext()).i...
[ { "content": "Called when a drawer animation has successfully completed.", "role": "user" }, { "content": "private void completeAnimation() {\n\t\tmScroller.abortAnimation();\n\t\tfinal int finalX = mScroller.getFinalX();\n\t\tsetOffsetPixels(finalX);\n\t\tsetDrawerState(finalX == 0 ? STATE_CLOSED :...
[ { "content": "Callback when each frame in the drawer animation should be drawn.", "role": "user" }, { "content": "@SuppressLint(\"NewApi\")\n\tprivate void postAnimationInvalidate() {\n\t\tif (mScroller.computeScrollOffset()) {\n\t\t\tfinal int oldX = (int) mOffsetPixels;\n\t\t\tfinal int x = mScrol...
[ { "content": "Callback when each frame in the peek drawer animation should be drawn.", "role": "user" }, { "content": "@SuppressLint(\"NewApi\")\n\tprivate void peekDrawerInvalidate() {\n\t\tif (mPeekScroller.computeScrollOffset()) {\n\t\t\tfinal int oldX = (int) mOffsetPixels;\n\t\t\tfinal int x = ...
[ { "content": "Call this when you want to know the new location. If it returns true,\nthe animation is not yet finished. loc will be altered to provide the\nnew location.", "role": "user" }, { "content": "public boolean computeScrollOffset() {\n if (mFinished) {\n return false;\n ...
[ { "content": "Start scrolling by providing a starting point and the distance to travel.\nThe scroll will use the default value of 250 milliseconds for the\nduration.\n\n@param startX Starting horizontal scroll offset in pixels. Positive\nnumbers will scroll the content to the left.\n@param startY Starting verti...
[ { "content": "The object may have been serialized to a primitive type with a\ncustom serializer, so try again after wrapping as an object property.\nWe do this trick only as a falllback since it causes Jackson to consider the parameter\nas \"Object\" and thus ignore any annotations that may exist on its actual ...
[ { "content": "Returns a client instance for AWS DynamoDB.\n@return a client that talks to DynamoDB", "role": "user" }, { "content": "public static AmazonDynamoDB getClient() {\n\t\tif (ddbClient != null) {\n\t\t\treturn ddbClient;\n\t\t}\n\n\t\tif (Config.IN_PRODUCTION) {\n\t\t\tddbClient = AmazonDy...
[ { "content": "Checks if the main table exists in the database.\n@param appid name of the {@link com.erudika.para.core.App}\n@return true if the table exists", "role": "user" }, { "content": "public static boolean existsTable(String appid) {\n\t\tif (StringUtils.isBlank(appid)) {\n\t\t\treturn false;...
[ { "content": "Creates a table in AWS DynamoDB.\n@param appid name of the {@link com.erudika.para.core.App}\n@param readCapacity read capacity\n@param writeCapacity write capacity\n@return true if created", "role": "user" }, { "content": "public static boolean createTable(String appid, long readCapac...
[ { "content": "Deletes the main table from AWS DynamoDB.\n@param appid name of the {@link com.erudika.para.core.App}\n@return true if deleted", "role": "user" }, { "content": "public static boolean deleteTable(String appid) {\n\t\tif (StringUtils.isBlank(appid) || !existsTable(appid)) {\n\t\t\treturn...
[ { "content": "Creates a table in AWS DynamoDB which will be shared between apps.\n@param readCapacity read capacity\n@param writeCapacity write capacity\n@return true if created", "role": "user" }, { "content": "public static boolean createSharedTable(long readCapacity, long writeCapacity) {\n\t\tif...
[ { "content": "Lists all table names for this account.\n@return a list of DynamoDB tables", "role": "user" }, { "content": "public static List<String> listAllTables() {\n\t\tint items = 100;\n\t\tListTablesResult ltr = getClient().listTables(items);\n\t\tList<String> tables = new LinkedList<>();\n\t\...
[ { "content": "Returns the table name for a given app id. Table names are usually in the form 'prefix-appid'.\n@param appIdentifier app id\n@return the table name", "role": "user" }, { "content": "public static String getTableNameForAppid(String appIdentifier) {\n\t\tif (StringUtils.isBlank(appIdenti...
[ { "content": "Reads multiple items from DynamoDB, in batch.\n@param <P> type of object\n@param kna a map of row key->data\n@param results a map of ID->ParaObject", "role": "user" }, { "content": "protected static <P extends ParaObject> void batchGet(Map<String, KeysAndAttributes> kna, Map<String, P>...
[ { "content": "Writes multiple items in batch.\n@param items a map of tables->write requests\n@param backoff backoff seconds", "role": "user" }, { "content": "protected static void batchWrite(Map<String, List<WriteRequest>> items, int backoff) {\n\t\tif (items == null || items.isEmpty()) {\n\t\t\tret...
[ { "content": "Reads a page from a standard DynamoDB table.\n@param <P> type of object\n@param appid the app identifier (name)\n@param p a {@link Pager}\n@return the last row key of the page, or null.", "role": "user" }, { "content": "public static <P extends ParaObject> List<P> readPageFromTable(Str...
[ { "content": "Reads a page from a \"shared\" DynamoDB table. Shared tables are tables that have global secondary indexes\nand can contain the objects of multiple apps.\n@param <P> type of object\n@param appid the app identifier (name)\n@param pager a {@link Pager}\n@return the id of the last object on the page,...
[ { "content": "Deletes all objects in a shared table, which belong to a given appid, by scanning the GSI.\n@param appid app id", "role": "user" }, { "content": "public static void deleteAllFromSharedTable(String appid) {\n\t\tif (StringUtils.isBlank(appid) || !isSharedAppid(appid)) {\n\t\t\treturn;\n...
[ { "content": "Returns the Index object for the shared table.\n@return the Index object or null", "role": "user" }, { "content": "public static Index getSharedIndex() {\n\t\tif (ddb == null) {\n\t\t\tgetClient();\n\t\t}\n\t\ttry {\n\t\t\tTable t = ddb.getTable(getTableNameForAppid(SHARED_TABLE));\n\t...
[ { "content": "Sets a preferred currency. Default is \"EUR\".\n@param currency a 3-letter currency code", "role": "user" }, { "content": "public void setCurrency(String currency) {\n\t\tcurrency = StringUtils.upperCase(currency);\n\t\tif (!CurrencyUtils.getInstance().isValidCurrency(currency)) {\n\t\...
[ { "content": "Detaches a secondary identifier which is not already used by this user.\n@param identifier an attached identifier", "role": "user" }, { "content": "public void detachIdentifier(String identifier) {\n\t\tif (!StringUtils.equals(identifier, getIdentifier())) {\n\t\t\tSysprop s = CoreUtil...
[ { "content": "Checks for moderator rights.\n@return true if user has mod rights", "role": "user" }, { "content": "@JsonIgnore\n\tpublic boolean isModerator() {\n\t\treturn isAdmin() ? true : StringUtils.equalsIgnoreCase(this.groups, Groups.MODS.toString());\n\t}", "role": "assistant" } ]
[ { "content": "Returns the name of the identity provider.\n@return \"facebook\", \"google\"... etc.", "role": "user" }, { "content": "public String getIdentityProvider() {\n\t\tif (isFacebookUser()) {\n\t\t\treturn \"facebook\";\n\t\t} else if (isGooglePlusUser()) {\n\t\t\treturn \"google\";\n\t\t} e...
[ { "content": "Returns a user object for a given identifier.\n@param u a user having a valid identifier set.\n@return a user or null if no user is found for this identifier", "role": "user" }, { "content": "public static final User readUserForIdentifier(final User u) {\n\t\tif (u == null || StringUti...
[ { "content": "Checks if a user has entered the correct password.\nCompares password hashes.\n@param u a user with a set password\n@return true if password matches the one in the data store", "role": "user" }, { "content": "public static final boolean passwordMatches(User u) {\n\t\tif (u == null) {\n...
[ { "content": "Generates a new password reset token. Sent via email for pass reset.\n@return the pass reset token", "role": "user" }, { "content": "public final String generatePasswordResetToken() {\n\t\tif (StringUtils.isBlank(identifier)) {\n\t\t\treturn \"\";\n\t\t}\n\t\tSysprop s = CoreUtils.getI...
[ { "content": "Changes the user password permanently.\n@param token the reset token. see {@link #generatePasswordResetToken()}\n@param newpass the new password\n@return true if successful", "role": "user" }, { "content": "public final boolean resetPassword(String token, String newpass) {\n\t\tif (Str...
[ { "content": "Deletes the identifier and the user can no longer sign in with it.\n@param ident the attached identifier", "role": "user" }, { "content": "private void deleteIdentifier(String ident) {\n\t\tif (!StringUtils.isBlank(ident)) {\n\t\t\tCoreUtils.getInstance().getDao().delete(getAppid(), ne...
[ { "content": "Generates a new email confirmation token. Sent via email for user activation.\n@return a Base64 encoded UUID", "role": "user" }, { "content": "public String generateEmailConfirmationToken() {\n\t\tif (StringUtils.isBlank(identifier)) {\n\t\t\treturn \"\";\n\t\t}\n\t\tSysprop s = CoreUt...
[ { "content": "Activates a user if a given token matches the one stored.\n@param token the email confirmation token. see {@link #generateEmailConfirmationToken() }\n@return true if successful", "role": "user" }, { "content": "public final boolean activateWithEmailToken(String token) {\n\t\tSysprop s ...
[ { "content": "Validates a token sent via email for password reset.\n@param token a token\n@return true if valid", "role": "user" }, { "content": "public final boolean isValidPasswordResetToken(String token) {\n\t\tSysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);\n\t\treturn...
[ { "content": "Validates a token sent for email confirmation.\n@param token a token\n@return true if valid", "role": "user" }, { "content": "public final boolean isValidEmailConfirmationToken(String token) {\n\t\tSysprop s = CoreUtils.getInstance().getDao().read(getAppid(), identifier);\n\t\treturn i...
[ { "content": "Sets the profile picture using the Gravatar service.", "role": "user" }, { "content": "private void setGravatarPicture() {\n\t\tif (StringUtils.isBlank(picture)) {\n\t\t\tif (email != null) {\n\t\t\t\tString emailHash = Utils.md5(email.toLowerCase());\n\t\t\t\tsetPicture(\"https://www....
[ { "content": "Extracts the access key from a request. It can be a header or a parameter.\n@param request a request\n@return the access key", "role": "user" }, { "content": "public static String extractAccessKey(HttpServletRequest request) {\n\t\tif (request == null) {\n\t\t\treturn \"\";\n\t\t}\n\t\...
[ { "content": "Check if Authorization header starts with 'Anonymous'. Used for guest access.\n@param request a request\n@return true if user is unauthenticated", "role": "user" }, { "content": "public static boolean isAnonymousRequest(HttpServletRequest request) {\n\t\treturn request != null &&\n\t\t...
[ { "content": "Extracts the date field from a request. It can be a header or a parameter.\n@param request a request\n@return the date", "role": "user" }, { "content": "public static String extractDate(HttpServletRequest request) {\n\t\tif (request == null) {\n\t\t\treturn \"\";\n\t\t}\n\t\tString dat...
[ { "content": "Returns a Response with the entity object inside it and 200 status code.\nIf there was and error the status code is different than 200.\n\n@param is the entity input stream\n@param type the type to convert the entity into, for example a Map. If null, this returns the InputStream.\n@return response...
[ { "content": "Reads the bytes from an InputStream.\n@param in an InputStream\n@return byte[]", "role": "user" }, { "content": "public static byte[] readEntityBytes(InputStream in) {\n\t\tbyte[] jsonEntity = null;\n\t\ttry {\n\t\t\tif (in != null && in.available() > 0) {\n\t\t\t\tByteArrayOutputStrea...
[ { "content": "Process voting request and create vote object.\n@param object the object to cast vote on\n@param entity request entity data\n@return status codetrue if vote was successful", "role": "user" }, { "content": "public static Response getVotingResponse(ParaObject object, Map<String, Object> ...
[ { "content": "Read response as JSON.\n@param app the app object\n@param content the object that was read\n@return status code 200 or 404", "role": "user" }, { "content": "public static Response getReadResponse(App app, ParaObject content) {\n\t\ttry (final Metrics.Context context = Metrics.time(app ...
[ { "content": "Create response as JSON.\n@param type type of the object to create\n@param is entity input stream\n@param app the app object\n@return a status code 201 or 400", "role": "user" }, { "content": "public static Response getCreateResponse(App app, String type, InputStream is) {\n\t\ttry (fi...
[ { "content": "Overwrite response as JSON.\n@param id the object id\n@param type type of the object to create\n@param is entity input stream\n@param app the app object\n@return a status code 200 or 400", "role": "user" }, { "content": "public static Response getOverwriteResponse(App app, String id, S...
[ { "content": "Update response as JSON.\n@param object object to validate and update\n@param is entity input stream\n@param app the app object\n@return a status code 200 or 400 or 404", "role": "user" }, { "content": "public static Response getUpdateResponse(App app, ParaObject object, InputStream is...
[ { "content": "Delete response as JSON.\n@param content the object to delete\n@param app the current App object\n@return a status code 200 or 400", "role": "user" }, { "content": "public static Response getDeleteResponse(App app, ParaObject content) {\n\t\ttry (final Metrics.Context context = Metrics...
[ { "content": "Batch read response as JSON.\n@param app the current App object\n@param ids list of ids\n@return status code 200 or 400", "role": "user" }, { "content": "public static Response getBatchReadResponse(App app, List<String> ids) {\n\t\ttry (final Metrics.Context context = Metrics.time(app ...
[ { "content": "Batch create response as JSON.\n@param app the current App object\n@param is entity input stream\n@return a status code 200 or 400", "role": "user" }, { "content": "public static Response getBatchCreateResponse(final App app, InputStream is) {\n\t\ttry (final Metrics.Context context = ...
[ { "content": "Batch update response as JSON.\n@param app the current App object\n@param oldObjects a list of old objects read from DB\n@param newProperties a list of new object properties to be updated\n@return a status code 200 or 400", "role": "user" }, { "content": "public static Response getBatc...
[ { "content": "Batch delete response as JSON.\n@param app the current App object\n@param ids list of ids to delete\n@return a status code 200 or 400", "role": "user" }, { "content": "public static Response getBatchDeleteResponse(App app, List<String> ids) {\n\t\ttry (final Metrics.Context context = M...
[ { "content": "Handles requests to search for linked objects.\n@param pobj the object to operate on\n@param id2 the id of the second object (optional)\n@param type2 the type of the second object\n@param params query parameters\n@param pager a {@link Pager} object\n@param childrenOnly find only directly linked ob...
[ { "content": "Handles requests to delete linked objects.\n@param pobj the object to operate on\n@param id2 the id of the second object (optional)\n@param type2 the type of the second object\n@param childrenOnly find only directly linked objects in 1-to-many relationship\n@return a Response", "role": "user" ...
[ { "content": "Handles requests to link an object to other objects.\n@param pobj the object to operate on\n@param id2 the id of the second object (optional)\n@return a Response", "role": "user" }, { "content": "public static Response createLinksHandler(ParaObject pobj, String id2) {\n\t\ttry (final M...
[ { "content": "A generic JSON response handler.\n@param status status code\n@param messages zero or more errors\n@return a response as JSON", "role": "user" }, { "content": "public static Response getStatusResponse(Response.Status status, String... messages) {\n\t\tif (status == null) {\n\t\t\treturn...
[ { "content": "A generic JSON response handler. Returns a message and response code.\n@param response the response to write to\n@param status status code\n@param message error message", "role": "user" }, { "content": "public static void returnStatusResponse(HttpServletResponse response, int status, S...
[ { "content": "Returns the path parameter value.\n@param param a parameter name\n@param ctx ctx\n@return a value", "role": "user" }, { "content": "public static String pathParam(String param, ContainerRequestContext ctx) {\n\t\treturn ctx.getUriInfo().getPathParameters().getFirst(param);\n\t}", "...
[ { "content": "Returns the path parameters values.\n@param param a parameter name\n@param ctx ctx\n@return a list of parameter values", "role": "user" }, { "content": "public static List<String> pathParams(String param, ContainerRequestContext ctx) {\n\t\treturn ctx.getUriInfo().getPathParameters().g...
[ { "content": "Returns the query parameter value.\n@param param a parameter name\n@param ctx ctx\n@return parameter value", "role": "user" }, { "content": "public static String queryParam(String param, ContainerRequestContext ctx) {\n\t\treturn ctx.getUriInfo().getQueryParameters().getFirst(param);\...
[ { "content": "Returns the query parameter values.\n@param param a parameter name\n@param ctx ctx\n@return a list of values", "role": "user" }, { "content": "public static List<String> queryParams(String param, ContainerRequestContext ctx) {\n\t\treturn ctx.getUriInfo().getQueryParameters().get(param...
[ { "content": "Returns true if parameter exists.\n@param param a parameter name\n@param ctx ctx\n@return true if parameter is set", "role": "user" }, { "content": "public static boolean hasQueryParam(String param, ContainerRequestContext ctx) {\n\t\treturn ctx.getUriInfo().getQueryParameters().contai...
[ { "content": "Returns the queue URL on SQS.\n@return returns the URL of this queue", "role": "user" }, { "content": "public String getUrl() {\n\t\tif (StringUtils.isBlank(url) && !StringUtils.isBlank(name)) {\n\t\t\tthis.url = AWSQueueUtils.createQueue(name);\n\t\t}\n\t\treturn url;\n\t}", "role...
[ { "content": "Checks if the request uri is an include. These cannot be gzipped.", "role": "user" }, { "content": "private boolean isIncluded(final HttpServletRequest request) {\n\t\tfinal String uri = (String) request.getAttribute(\"javax.servlet.include.request_uri\");\n\t\tfinal boolean includeReq...
[ { "content": "Returns a parsed Date.\n@param date a date in the AWS format yyyyMMdd'T'HHmmss'Z'\n@return a date", "role": "user" }, { "content": "public static Date parseAWSDate(String date) {\n\t\tif (date == null) {\n\t\t\treturn null;\n\t\t}\n\t\treturn TIME_FORMATTER.parseDateTime(date).toDate()...
[ { "content": "Builds and signs a request to an API endpoint using the provided credentials.\n@param accessKey access key\n@param secretKey secret key\n@param httpMethod the method (GET, POST...)\n@param endpointURL protocol://host:port\n@param reqPath the API resource path relative to the endpointURL\n@param he...
[ { "content": "Validates objects using Hibernate Validator.\n@param content an object to be validated\n@return a list of error messages or empty if object is valid", "role": "user" }, { "content": "public static String[] validateObject(ParaObject content) {\n\t\tif (content == null) {\n\t\t\treturn n...
[ { "content": "Validates objects.\n@param content an object to be validated\n@param app the current app\n@return a list of error messages or empty if object is valid", "role": "user" }, { "content": "public static String[] validateObject(App app, ParaObject content) {\n\t\tif (content == null || app ...
[ { "content": "Returns all validation constraints that are defined by Java annotation in the core classes.\n\n@return a map of all core types to all core annotated constraints. See JSR-303.", "role": "user" }, { "content": "public static Map<String, Map<String, Map<String, Map<String, ?>>>> getCoreVa...
[ { "content": "Executes code when a method is invoked. A big switch statement.\n@param mi method invocation\n@return the returned value of the method invoked or something else (decided here)\n@throws Throwable error", "role": "user" }, { "content": "public Object invoke(MethodInvocation mi) throws Th...