repo stringlengths 7 58 | path stringlengths 12 218 | func_name stringlengths 3 140 | original_string stringlengths 73 34.1k | language stringclasses 1
value | code stringlengths 73 34.1k | code_tokens list | docstring stringlengths 3 16k | docstring_tokens list | sha stringlengths 40 40 | url stringlengths 105 339 | partition stringclasses 1
value |
|---|---|---|---|---|---|---|---|---|---|---|---|
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._orElse | public void _orElse() {
List<QueryToken> tokens = getCurrentWhereTokens();
if (tokens.isEmpty()) {
return;
}
if (tokens.get(tokens.size() - 1) instanceof QueryOperatorToken) {
throw new IllegalStateException("Cannot add OR, previous token was already an operator ... | java | public void _orElse() {
List<QueryToken> tokens = getCurrentWhereTokens();
if (tokens.isEmpty()) {
return;
}
if (tokens.get(tokens.size() - 1) instanceof QueryOperatorToken) {
throw new IllegalStateException("Cannot add OR, previous token was already an operator ... | [
"public",
"void",
"_orElse",
"(",
")",
"{",
"List",
"<",
"QueryToken",
">",
"tokens",
"=",
"getCurrentWhereTokens",
"(",
")",
";",
"if",
"(",
"tokens",
".",
"isEmpty",
"(",
")",
")",
"{",
"return",
";",
"}",
"if",
"(",
"tokens",
".",
"get",
"(",
"t... | Add an OR to the query | [
"Add",
"an",
"OR",
"to",
"the",
"query"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L809-L820 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._orderBy | public void _orderBy(String field, OrderingType ordering) {
assertNoRawQuery();
String f = ensureValidFieldName(field, false);
orderByTokens.add(OrderByToken.createAscending(f, ordering));
} | java | public void _orderBy(String field, OrderingType ordering) {
assertNoRawQuery();
String f = ensureValidFieldName(field, false);
orderByTokens.add(OrderByToken.createAscending(f, ordering));
} | [
"public",
"void",
"_orderBy",
"(",
"String",
"field",
",",
"OrderingType",
"ordering",
")",
"{",
"assertNoRawQuery",
"(",
")",
";",
"String",
"f",
"=",
"ensureValidFieldName",
"(",
"field",
",",
"false",
")",
";",
"orderByTokens",
".",
"add",
"(",
"OrderByTo... | Order the results by the specified fields
The fields are the names of the fields to sort, defaulting to sorting by ascending.
You can prefix a field name with '-' to indicate sorting by descending or '+' to sort by ascending
@param field field to use in order
@param ordering Ordering type | [
"Order",
"the",
"results",
"by",
"the",
"specified",
"fields",
"The",
"fields",
"are",
"the",
"names",
"of",
"the",
"fields",
"to",
"sort",
"defaulting",
"to",
"sorting",
"by",
"ascending",
".",
"You",
"can",
"prefix",
"a",
"field",
"name",
"with",
"-",
... | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L932-L936 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery._orderByDescending | public void _orderByDescending(String field, OrderingType ordering) {
assertNoRawQuery();
String f = ensureValidFieldName(field, false);
orderByTokens.add(OrderByToken.createDescending(f, ordering));
} | java | public void _orderByDescending(String field, OrderingType ordering) {
assertNoRawQuery();
String f = ensureValidFieldName(field, false);
orderByTokens.add(OrderByToken.createDescending(f, ordering));
} | [
"public",
"void",
"_orderByDescending",
"(",
"String",
"field",
",",
"OrderingType",
"ordering",
")",
"{",
"assertNoRawQuery",
"(",
")",
";",
"String",
"f",
"=",
"ensureValidFieldName",
"(",
"field",
",",
"false",
")",
";",
"orderByTokens",
".",
"add",
"(",
... | Order the results by the specified fields
The fields are the names of the fields to sort, defaulting to sorting by descending.
You can prefix a field name with '-' to indicate sorting by descending or '+' to sort by ascending
@param field Field to use
@param ordering Ordering type | [
"Order",
"the",
"results",
"by",
"the",
"specified",
"fields",
"The",
"fields",
"are",
"the",
"names",
"of",
"the",
"fields",
"to",
"sort",
"defaulting",
"to",
"sorting",
"by",
"descending",
".",
"You",
"can",
"prefix",
"a",
"field",
"name",
"with",
"-",
... | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L955-L959 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java | AbstractDocumentQuery.generateIndexQuery | protected IndexQuery generateIndexQuery(String query) {
IndexQuery indexQuery = new IndexQuery();
indexQuery.setQuery(query);
indexQuery.setStart(start);
indexQuery.setWaitForNonStaleResults(theWaitForNonStaleResults);
indexQuery.setWaitForNonStaleResultsTimeout(timeout);
... | java | protected IndexQuery generateIndexQuery(String query) {
IndexQuery indexQuery = new IndexQuery();
indexQuery.setQuery(query);
indexQuery.setStart(start);
indexQuery.setWaitForNonStaleResults(theWaitForNonStaleResults);
indexQuery.setWaitForNonStaleResultsTimeout(timeout);
... | [
"protected",
"IndexQuery",
"generateIndexQuery",
"(",
"String",
"query",
")",
"{",
"IndexQuery",
"indexQuery",
"=",
"new",
"IndexQuery",
"(",
")",
";",
"indexQuery",
".",
"setQuery",
"(",
"query",
")",
";",
"indexQuery",
".",
"setStart",
"(",
"start",
")",
"... | Generates the index query.
@param query Query
@return Index query | [
"Generates",
"the",
"index",
"query",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/AbstractDocumentQuery.java#L1001-L1014 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/queries/QueryResult.java | QueryResult.createSnapshot | public QueryResult createSnapshot() {
QueryResult queryResult = new QueryResult();
queryResult.setResults(getResults());
queryResult.setIncludes(getIncludes());
queryResult.setIndexName(getIndexName());
queryResult.setIndexTimestamp(getIndexTimestamp());
queryResult.setIn... | java | public QueryResult createSnapshot() {
QueryResult queryResult = new QueryResult();
queryResult.setResults(getResults());
queryResult.setIncludes(getIncludes());
queryResult.setIndexName(getIndexName());
queryResult.setIndexTimestamp(getIndexTimestamp());
queryResult.setIn... | [
"public",
"QueryResult",
"createSnapshot",
"(",
")",
"{",
"QueryResult",
"queryResult",
"=",
"new",
"QueryResult",
"(",
")",
";",
"queryResult",
".",
"setResults",
"(",
"getResults",
"(",
")",
")",
";",
"queryResult",
".",
"setIncludes",
"(",
"getIncludes",
"(... | Creates a snapshot of the query results
@return returns snapshot of query result | [
"Creates",
"a",
"snapshot",
"of",
"the",
"query",
"results"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/queries/QueryResult.java#L14-L34 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.getSubscriptions | public List<SubscriptionState> getSubscriptions(int start, int take, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
GetSubscriptionsCommand command = new GetSubscriptionsCommand(start, take);
requestExecu... | java | public List<SubscriptionState> getSubscriptions(int start, int take, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
GetSubscriptionsCommand command = new GetSubscriptionsCommand(start, take);
requestExecu... | [
"public",
"List",
"<",
"SubscriptionState",
">",
"getSubscriptions",
"(",
"int",
"start",
",",
"int",
"take",
",",
"String",
"database",
")",
"{",
"RequestExecutor",
"requestExecutor",
"=",
"_store",
".",
"getRequestExecutor",
"(",
"ObjectUtils",
".",
"firstNonNul... | It downloads a list of all existing subscriptions in a database.
@param start Range start
@param take Maximum number of items that will be retrieved
@param database Database to use
@return List of subscriptions state | [
"It",
"downloads",
"a",
"list",
"of",
"all",
"existing",
"subscriptions",
"in",
"a",
"database",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L355-L362 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.delete | public void delete(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DeleteSubscriptionCommand command = new DeleteSubscriptionCommand(name);
requestExecutor.execute(command);
} | java | public void delete(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DeleteSubscriptionCommand command = new DeleteSubscriptionCommand(name);
requestExecutor.execute(command);
} | [
"public",
"void",
"delete",
"(",
"String",
"name",
",",
"String",
"database",
")",
"{",
"RequestExecutor",
"requestExecutor",
"=",
"_store",
".",
"getRequestExecutor",
"(",
"ObjectUtils",
".",
"firstNonNull",
"(",
"database",
",",
"_store",
".",
"getDatabase",
"... | Delete a subscription.
@param name Subscription name
@param database Database to use | [
"Delete",
"a",
"subscription",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L378-L383 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.getSubscriptionState | public SubscriptionState getSubscriptionState(String subscriptionName, String database) {
if (StringUtils.isEmpty(subscriptionName)) {
throw new IllegalArgumentException("SubscriptionName cannot be null");
}
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.fir... | java | public SubscriptionState getSubscriptionState(String subscriptionName, String database) {
if (StringUtils.isEmpty(subscriptionName)) {
throw new IllegalArgumentException("SubscriptionName cannot be null");
}
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.fir... | [
"public",
"SubscriptionState",
"getSubscriptionState",
"(",
"String",
"subscriptionName",
",",
"String",
"database",
")",
"{",
"if",
"(",
"StringUtils",
".",
"isEmpty",
"(",
"subscriptionName",
")",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Subsc... | Returns subscription definition and it's current state
@param subscriptionName Subscription name as received from the server
@param database Database to use
@return Subscription states | [
"Returns",
"subscription",
"definition",
"and",
"it",
"s",
"current",
"state"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L400-L410 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java | DocumentSubscriptions.dropConnection | public void dropConnection(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
requestExecutor.execute(comm... | java | public void dropConnection(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
requestExecutor.execute(comm... | [
"public",
"void",
"dropConnection",
"(",
"String",
"name",
",",
"String",
"database",
")",
"{",
"RequestExecutor",
"requestExecutor",
"=",
"_store",
".",
"getRequestExecutor",
"(",
"ObjectUtils",
".",
"firstNonNull",
"(",
"database",
",",
"_store",
".",
"getDataba... | Force server to close current client subscription connection to the server
@param name Subscription name
@param database Database to use | [
"Force",
"server",
"to",
"close",
"current",
"client",
"subscription",
"connection",
"to",
"the",
"server"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/subscriptions/DocumentSubscriptions.java#L436-L441 | train |
wcm-io/wcm-io-wcm | ui/granite/src/main/java/io/wcm/wcm/ui/granite/util/GraniteUi.java | GraniteUi.getContentPath | private static String getContentPath(HttpServletRequest request) {
String contentPath = (String)request.getAttribute(Value.CONTENTPATH_ATTRIBUTE);
if (contentPath == null) {
// fallback to suffix if CONTENTPATH_ATTRIBUTE is not set
// (e.g. in inside a /libs/granite/ui/components/foundation/form/mu... | java | private static String getContentPath(HttpServletRequest request) {
String contentPath = (String)request.getAttribute(Value.CONTENTPATH_ATTRIBUTE);
if (contentPath == null) {
// fallback to suffix if CONTENTPATH_ATTRIBUTE is not set
// (e.g. in inside a /libs/granite/ui/components/foundation/form/mu... | [
"private",
"static",
"String",
"getContentPath",
"(",
"HttpServletRequest",
"request",
")",
"{",
"String",
"contentPath",
"=",
"(",
"String",
")",
"request",
".",
"getAttribute",
"(",
"Value",
".",
"CONTENTPATH_ATTRIBUTE",
")",
";",
"if",
"(",
"contentPath",
"==... | Current content path
@param request Request
@return Current content path or null | [
"Current",
"content",
"path"
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/granite/src/main/java/io/wcm/wcm/ui/granite/util/GraniteUi.java#L113-L123 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/primitives/EventHelper.java | EventHelper.invoke | public static <T extends EventArgs> void invoke(List<EventHandler<T>> delegates, Object sender, T event) {
for (EventHandler<T> delegate : delegates) {
delegate.handle(sender, event);
}
} | java | public static <T extends EventArgs> void invoke(List<EventHandler<T>> delegates, Object sender, T event) {
for (EventHandler<T> delegate : delegates) {
delegate.handle(sender, event);
}
} | [
"public",
"static",
"<",
"T",
"extends",
"EventArgs",
">",
"void",
"invoke",
"(",
"List",
"<",
"EventHandler",
"<",
"T",
">",
">",
"delegates",
",",
"Object",
"sender",
",",
"T",
"event",
")",
"{",
"for",
"(",
"EventHandler",
"<",
"T",
">",
"delegate",... | Helper used for invoking event on list of delegates
@param <T> event class
@param delegates Event delegates
@param sender Event sender
@param event Event to send | [
"Helper",
"used",
"for",
"invoking",
"event",
"on",
"list",
"of",
"delegates"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/primitives/EventHelper.java#L16-L20 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/primitives/NetISO8601Utils.java | NetISO8601Utils.checkOffset | private static void checkOffset(String value, int offset, char expected) throws IndexOutOfBoundsException {
char found = value.charAt(offset);
if (found != expected) {
throw new IndexOutOfBoundsException("Expected '" + expected + "' character but found '" + found + "'");
}
} | java | private static void checkOffset(String value, int offset, char expected) throws IndexOutOfBoundsException {
char found = value.charAt(offset);
if (found != expected) {
throw new IndexOutOfBoundsException("Expected '" + expected + "' character but found '" + found + "'");
}
} | [
"private",
"static",
"void",
"checkOffset",
"(",
"String",
"value",
",",
"int",
"offset",
",",
"char",
"expected",
")",
"throws",
"IndexOutOfBoundsException",
"{",
"char",
"found",
"=",
"value",
".",
"charAt",
"(",
"offset",
")",
";",
"if",
"(",
"found",
"... | Check if the expected character exist at the given offset of the
@param value the string to check at the specified offset
@param offset the offset to look for the expected character
@param expected the expected character
@throws IndexOutOfBoundsException if the expected character is not found | [
"Check",
"if",
"the",
"expected",
"character",
"exist",
"at",
"the",
"given",
"offset",
"of",
"the"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/primitives/NetISO8601Utils.java#L190-L195 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/DocumentSession.java | DocumentSession.saveChanges | @Override
public void saveChanges() {
BatchOperation saveChangeOperation = new BatchOperation(this);
try (BatchCommand command = saveChangeOperation.createRequest()) {
if (command == null) {
return;
}
if (noTracking) {
throw new I... | java | @Override
public void saveChanges() {
BatchOperation saveChangeOperation = new BatchOperation(this);
try (BatchCommand command = saveChangeOperation.createRequest()) {
if (command == null) {
return;
}
if (noTracking) {
throw new I... | [
"@",
"Override",
"public",
"void",
"saveChanges",
"(",
")",
"{",
"BatchOperation",
"saveChangeOperation",
"=",
"new",
"BatchOperation",
"(",
"this",
")",
";",
"try",
"(",
"BatchCommand",
"command",
"=",
"saveChangeOperation",
".",
"createRequest",
"(",
")",
")",... | Saves all the changes to the Raven server. | [
"Saves",
"all",
"the",
"changes",
"to",
"the",
"Raven",
"server",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/DocumentSession.java#L117-L134 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/DocumentSession.java | DocumentSession.exists | public boolean exists(String id) {
if (id == null) {
throw new IllegalArgumentException("id cannot be null");
}
if (_knownMissingIds.contains(id)) {
return false;
}
if (documentsById.getValue(id) != null) {
return true;
}
Hea... | java | public boolean exists(String id) {
if (id == null) {
throw new IllegalArgumentException("id cannot be null");
}
if (_knownMissingIds.contains(id)) {
return false;
}
if (documentsById.getValue(id) != null) {
return true;
}
Hea... | [
"public",
"boolean",
"exists",
"(",
"String",
"id",
")",
"{",
"if",
"(",
"id",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"id cannot be null\"",
")",
";",
"}",
"if",
"(",
"_knownMissingIds",
".",
"contains",
"(",
"id",
")",
... | Check if document exists without loading it | [
"Check",
"if",
"document",
"exists",
"without",
"loading",
"it"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/DocumentSession.java#L139-L157 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/DocumentSession.java | DocumentSession.refresh | public <T> void refresh(T entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo == null) {
throw new IllegalStateException("Cannot refresh a transient instance");
}
incrementRequestCount();
GetDocumentsCommand command = new GetDocumen... | java | public <T> void refresh(T entity) {
DocumentInfo documentInfo = documentsByEntity.get(entity);
if (documentInfo == null) {
throw new IllegalStateException("Cannot refresh a transient instance");
}
incrementRequestCount();
GetDocumentsCommand command = new GetDocumen... | [
"public",
"<",
"T",
">",
"void",
"refresh",
"(",
"T",
"entity",
")",
"{",
"DocumentInfo",
"documentInfo",
"=",
"documentsByEntity",
".",
"get",
"(",
"entity",
")",
";",
"if",
"(",
"documentInfo",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalStateExcepti... | Refreshes the specified entity from Raven server. | [
"Refreshes",
"the",
"specified",
"entity",
"from",
"Raven",
"server",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/DocumentSession.java#L162-L174 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/indexes/AbstractGenericIndexCreationTask.java | AbstractGenericIndexCreationTask.spatial | protected void spatial(String field, Function<SpatialOptionsFactory, SpatialOptions> indexing) {
spatialOptionsStrings.put(field, indexing.apply(new SpatialOptionsFactory()));
} | java | protected void spatial(String field, Function<SpatialOptionsFactory, SpatialOptions> indexing) {
spatialOptionsStrings.put(field, indexing.apply(new SpatialOptionsFactory()));
} | [
"protected",
"void",
"spatial",
"(",
"String",
"field",
",",
"Function",
"<",
"SpatialOptionsFactory",
",",
"SpatialOptions",
">",
"indexing",
")",
"{",
"spatialOptionsStrings",
".",
"put",
"(",
"field",
",",
"indexing",
".",
"apply",
"(",
"new",
"SpatialOptions... | Register a field to be spatially indexed
@param field Field
@param indexing factory for spatial options | [
"Register",
"a",
"field",
"to",
"be",
"spatially",
"indexed"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/indexes/AbstractGenericIndexCreationTask.java#L64-L66 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/session/EntityToJson.java | EntityToJson.convertToEntity | @SuppressWarnings("unchecked")
public Object convertToEntity(Class entityType, String id, ObjectNode document) {
try {
if (ObjectNode.class.equals(entityType)) {
return document;
}
Object defaultValue = InMemoryDocumentSessionOperations.getDefaultValue(en... | java | @SuppressWarnings("unchecked")
public Object convertToEntity(Class entityType, String id, ObjectNode document) {
try {
if (ObjectNode.class.equals(entityType)) {
return document;
}
Object defaultValue = InMemoryDocumentSessionOperations.getDefaultValue(en... | [
"@",
"SuppressWarnings",
"(",
"\"unchecked\"",
")",
"public",
"Object",
"convertToEntity",
"(",
"Class",
"entityType",
",",
"String",
"id",
",",
"ObjectNode",
"document",
")",
"{",
"try",
"{",
"if",
"(",
"ObjectNode",
".",
"class",
".",
"equals",
"(",
"entit... | Converts a json object to an entity.
@param entityType Class of entity
@param id Id of entity
@param document Raw entity
@return Entity instance | [
"Converts",
"a",
"json",
"object",
"to",
"an",
"entity",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/session/EntityToJson.java#L110-L140 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java | AbstractPageTreeProvider.getPages | protected final JSONArray getPages(Iterator<Page> pages, int depth, PageFilter pageFilter) throws JSONException {
JSONArray pagesArray = new JSONArray();
while (pages.hasNext()) {
Page page = pages.next();
// map page attributes to JSON object
JSONObject pageObject = getPage(page);
if ... | java | protected final JSONArray getPages(Iterator<Page> pages, int depth, PageFilter pageFilter) throws JSONException {
JSONArray pagesArray = new JSONArray();
while (pages.hasNext()) {
Page page = pages.next();
// map page attributes to JSON object
JSONObject pageObject = getPage(page);
if ... | [
"protected",
"final",
"JSONArray",
"getPages",
"(",
"Iterator",
"<",
"Page",
">",
"pages",
",",
"int",
"depth",
",",
"PageFilter",
"pageFilter",
")",
"throws",
"JSONException",
"{",
"JSONArray",
"pagesArray",
"=",
"new",
"JSONArray",
"(",
")",
";",
"while",
... | Generate JSON objects for pages.
@param pages Child page iterator
@param depth Depth
@param pageFilter Page filter
@return Page array
@throws JSONException JSON exception | [
"Generate",
"JSON",
"objects",
"for",
"pages",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java#L59-L83 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java | AbstractPageTreeProvider.listChildren | protected final Iterator<Page> listChildren(Resource parentResource, PageFilter pageFilter) {
return new PageIterator(parentResource.listChildren(), pageFilter);
} | java | protected final Iterator<Page> listChildren(Resource parentResource, PageFilter pageFilter) {
return new PageIterator(parentResource.listChildren(), pageFilter);
} | [
"protected",
"final",
"Iterator",
"<",
"Page",
">",
"listChildren",
"(",
"Resource",
"parentResource",
",",
"PageFilter",
"pageFilter",
")",
"{",
"return",
"new",
"PageIterator",
"(",
"parentResource",
".",
"listChildren",
"(",
")",
",",
"pageFilter",
")",
";",
... | Lists children using custom page iterator.
@param parentResource Parent resource
@param pageFilter Page filter
@return Page iterator | [
"Lists",
"children",
"using",
"custom",
"page",
"iterator",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java#L91-L93 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java | AbstractPageTreeProvider.getPage | @SuppressWarnings("null")
protected final JSONObject getPage(Page page) throws JSONException {
Resource resource = page.adaptTo(Resource.class);
JSONObject pageObject = new JSONObject();
// node name
pageObject.put("name", page.getName());
// node title text
String title = page.getTitle();
... | java | @SuppressWarnings("null")
protected final JSONObject getPage(Page page) throws JSONException {
Resource resource = page.adaptTo(Resource.class);
JSONObject pageObject = new JSONObject();
// node name
pageObject.put("name", page.getName());
// node title text
String title = page.getTitle();
... | [
"@",
"SuppressWarnings",
"(",
"\"null\"",
")",
"protected",
"final",
"JSONObject",
"getPage",
"(",
"Page",
"page",
")",
"throws",
"JSONException",
"{",
"Resource",
"resource",
"=",
"page",
".",
"adaptTo",
"(",
"Resource",
".",
"class",
")",
";",
"JSONObject",
... | Generate JSON object for page
@param page Page
@return JSON object
@throws JSONException JSON exception | [
"Generate",
"JSON",
"object",
"for",
"page"
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageTreeProvider.java#L101-L130 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/DocumentStore.java | DocumentStore.getIdentifier | public String getIdentifier() {
if (identifier != null) {
return identifier;
}
if (urls == null) {
return null;
}
if (database != null) {
return String.join(",", urls) + " (DB: " + database + ")";
}
return String.join(",", ur... | java | public String getIdentifier() {
if (identifier != null) {
return identifier;
}
if (urls == null) {
return null;
}
if (database != null) {
return String.join(",", urls) + " (DB: " + database + ")";
}
return String.join(",", ur... | [
"public",
"String",
"getIdentifier",
"(",
")",
"{",
"if",
"(",
"identifier",
"!=",
"null",
")",
"{",
"return",
"identifier",
";",
"}",
"if",
"(",
"urls",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"if",
"(",
"database",
"!=",
"null",
")",
... | Gets the identifier for this store. | [
"Gets",
"the",
"identifier",
"for",
"this",
"store",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/DocumentStore.java#L69-L83 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/DocumentStore.java | DocumentStore.openSession | @Override
public IDocumentSession openSession(String database) {
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.setDatabase(database);
return openSession(sessionOptions);
} | java | @Override
public IDocumentSession openSession(String database) {
SessionOptions sessionOptions = new SessionOptions();
sessionOptions.setDatabase(database);
return openSession(sessionOptions);
} | [
"@",
"Override",
"public",
"IDocumentSession",
"openSession",
"(",
"String",
"database",
")",
"{",
"SessionOptions",
"sessionOptions",
"=",
"new",
"SessionOptions",
"(",
")",
";",
"sessionOptions",
".",
"setDatabase",
"(",
"database",
")",
";",
"return",
"openSess... | Opens the session for a particular database | [
"Opens",
"the",
"session",
"for",
"a",
"particular",
"database"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/DocumentStore.java#L144-L150 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/DocumentStore.java | DocumentStore.initialize | @Override
public IDocumentStore initialize() {
if (initialized) {
return this;
}
assertValidConfiguration();
try {
if (getConventions().getDocumentIdGenerator() == null) { // don't overwrite what the user is doing
MultiDatabaseHiLoIdGenerator... | java | @Override
public IDocumentStore initialize() {
if (initialized) {
return this;
}
assertValidConfiguration();
try {
if (getConventions().getDocumentIdGenerator() == null) { // don't overwrite what the user is doing
MultiDatabaseHiLoIdGenerator... | [
"@",
"Override",
"public",
"IDocumentStore",
"initialize",
"(",
")",
"{",
"if",
"(",
"initialized",
")",
"{",
"return",
"this",
";",
"}",
"assertValidConfiguration",
"(",
")",
";",
"try",
"{",
"if",
"(",
"getConventions",
"(",
")",
".",
"getDocumentIdGenerat... | Initializes this instance. | [
"Initializes",
"this",
"instance",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/DocumentStore.java#L196-L220 | train |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/EditableTemplate.java | EditableTemplate.isPageInTemplateDefinition | private static boolean isPageInTemplateDefinition(Page page) {
Resource resource = page.adaptTo(Resource.class);
if (resource != null) {
Resource parent = resource.getParent();
if (parent != null) {
return StringUtils.equals(NT_TEMPLATE, parent.getValueMap().get(JCR_PRIMARYTYPE, String.class... | java | private static boolean isPageInTemplateDefinition(Page page) {
Resource resource = page.adaptTo(Resource.class);
if (resource != null) {
Resource parent = resource.getParent();
if (parent != null) {
return StringUtils.equals(NT_TEMPLATE, parent.getValueMap().get(JCR_PRIMARYTYPE, String.class... | [
"private",
"static",
"boolean",
"isPageInTemplateDefinition",
"(",
"Page",
"page",
")",
"{",
"Resource",
"resource",
"=",
"page",
".",
"adaptTo",
"(",
"Resource",
".",
"class",
")",
";",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"Resource",
"parent",
... | Checks if the given page is part of the editable template definition itself.
@param page Page
@return true if page is part of template definition. | [
"Checks",
"if",
"the",
"given",
"page",
"is",
"part",
"of",
"the",
"editable",
"template",
"definition",
"itself",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/EditableTemplate.java#L113-L122 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/indexes/AbstractIndexCreationTaskBase.java | AbstractIndexCreationTaskBase.execute | public void execute(IDocumentStore store, DocumentConventions conventions, String database) {
DocumentConventions oldConventions = getConventions();
try {
setConventions(ObjectUtils.firstNonNull(conventions, getConventions(), store.getConventions()));
IndexDefinition indexDefini... | java | public void execute(IDocumentStore store, DocumentConventions conventions, String database) {
DocumentConventions oldConventions = getConventions();
try {
setConventions(ObjectUtils.firstNonNull(conventions, getConventions(), store.getConventions()));
IndexDefinition indexDefini... | [
"public",
"void",
"execute",
"(",
"IDocumentStore",
"store",
",",
"DocumentConventions",
"conventions",
",",
"String",
"database",
")",
"{",
"DocumentConventions",
"oldConventions",
"=",
"getConventions",
"(",
")",
";",
"try",
"{",
"setConventions",
"(",
"ObjectUtil... | Executes the index creation against the specified document database using the specified conventions
@param store target document store
@param conventions Document conventions to use
@param database Target database | [
"Executes",
"the",
"index",
"creation",
"against",
"the",
"specified",
"document",
"database",
"using",
"the",
"specified",
"conventions"
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/indexes/AbstractIndexCreationTaskBase.java#L104-L124 | train |
wcm-io/wcm-io-wcm | commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java | RunMode.is | @Deprecated
public static boolean is(Set<String> runModes, String... expectedRunModes) {
if (runModes != null && expectedRunModes != null) {
for (String expectedRunMode : expectedRunModes) {
if (runModes.contains(expectedRunMode)) {
return true;
}
}
}
return false;
... | java | @Deprecated
public static boolean is(Set<String> runModes, String... expectedRunModes) {
if (runModes != null && expectedRunModes != null) {
for (String expectedRunMode : expectedRunModes) {
if (runModes.contains(expectedRunMode)) {
return true;
}
}
}
return false;
... | [
"@",
"Deprecated",
"public",
"static",
"boolean",
"is",
"(",
"Set",
"<",
"String",
">",
"runModes",
",",
"String",
"...",
"expectedRunModes",
")",
"{",
"if",
"(",
"runModes",
"!=",
"null",
"&&",
"expectedRunModes",
"!=",
"null",
")",
"{",
"for",
"(",
"St... | Checks if given run mode is active.
@param runModes Run modes for current instance
@param expectedRunModes Run mode(s) to check for
@return true if any of the given run modes is active
@deprecated Instead of directly using the run modes, it is better to make the component in question require a
configuration (see OSGI D... | [
"Checks",
"if",
"given",
"run",
"mode",
"is",
"active",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/commons/src/main/java/io/wcm/wcm/commons/util/RunMode.java#L60-L70 | train |
ravendb/ravendb-jvm-client | src/main/java/net/ravendb/client/documents/indexes/AbstractIndexCreationTask.java | AbstractIndexCreationTask.createIndexDefinition | public IndexDefinition createIndexDefinition() {
if (conventions == null) {
conventions = new DocumentConventions();
}
IndexDefinitionBuilder indexDefinitionBuilder = new IndexDefinitionBuilder(getIndexName());
indexDefinitionBuilder.setIndexesStrings(indexesStrings);
... | java | public IndexDefinition createIndexDefinition() {
if (conventions == null) {
conventions = new DocumentConventions();
}
IndexDefinitionBuilder indexDefinitionBuilder = new IndexDefinitionBuilder(getIndexName());
indexDefinitionBuilder.setIndexesStrings(indexesStrings);
... | [
"public",
"IndexDefinition",
"createIndexDefinition",
"(",
")",
"{",
"if",
"(",
"conventions",
"==",
"null",
")",
"{",
"conventions",
"=",
"new",
"DocumentConventions",
"(",
")",
";",
"}",
"IndexDefinitionBuilder",
"indexDefinitionBuilder",
"=",
"new",
"IndexDefinit... | Creates the index definition.
@return Index definition | [
"Creates",
"the",
"index",
"definition",
"."
] | 5a45727de507b541d1571e79ddd97c7d88bee787 | https://github.com/ravendb/ravendb-jvm-client/blob/5a45727de507b541d1571e79ddd97c7d88bee787/src/main/java/net/ravendb/client/documents/indexes/AbstractIndexCreationTask.java#L15-L33 | train |
wcm-io/wcm-io-wcm | ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageProvider.java | AbstractPageProvider.getPageFilter | protected PageFilter getPageFilter(SlingHttpServletRequest request) {
// check for predicate filter
String predicateName = RequestParam.get(request, RP_PREDICATE);
if (StringUtils.isNotEmpty(predicateName)) {
PredicateProvider predicateProvider = getPredicateProvider();
if (predicateProvider ==... | java | protected PageFilter getPageFilter(SlingHttpServletRequest request) {
// check for predicate filter
String predicateName = RequestParam.get(request, RP_PREDICATE);
if (StringUtils.isNotEmpty(predicateName)) {
PredicateProvider predicateProvider = getPredicateProvider();
if (predicateProvider ==... | [
"protected",
"PageFilter",
"getPageFilter",
"(",
"SlingHttpServletRequest",
"request",
")",
"{",
"// check for predicate filter",
"String",
"predicateName",
"=",
"RequestParam",
".",
"get",
"(",
"request",
",",
"RP_PREDICATE",
")",
";",
"if",
"(",
"StringUtils",
".",
... | Can be overridden by subclasses to filter page list via page filter.
If not overridden it supports defining a page filter via "predicate" request attribute.
@param request Request
@return Page filter or null if no filtering applies | [
"Can",
"be",
"overridden",
"by",
"subclasses",
"to",
"filter",
"page",
"list",
"via",
"page",
"filter",
".",
"If",
"not",
"overridden",
"it",
"supports",
"defining",
"a",
"page",
"filter",
"via",
"predicate",
"request",
"attribute",
"."
] | 8eff9434f2f4b6462fdb718f8769ad793c55b8d7 | https://github.com/wcm-io/wcm-io-wcm/blob/8eff9434f2f4b6462fdb718f8769ad793c55b8d7/ui/extjs/src/main/java/io/wcm/wcm/ui/extjs/provider/AbstractPageProvider.java#L130-L147 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java | MetadataProviderImpl.getIndexedPropertyMethodMetadata | private IndexedPropertyMethodMetadata<?> getIndexedPropertyMethodMetadata(Collection<MethodMetadata<?, ?>> methodMetadataOfType) {
for (MethodMetadata methodMetadata : methodMetadataOfType) {
AnnotatedMethod annotatedMethod = methodMetadata.getAnnotatedMethod();
Annotation indexedAnnotat... | java | private IndexedPropertyMethodMetadata<?> getIndexedPropertyMethodMetadata(Collection<MethodMetadata<?, ?>> methodMetadataOfType) {
for (MethodMetadata methodMetadata : methodMetadataOfType) {
AnnotatedMethod annotatedMethod = methodMetadata.getAnnotatedMethod();
Annotation indexedAnnotat... | [
"private",
"IndexedPropertyMethodMetadata",
"<",
"?",
">",
"getIndexedPropertyMethodMetadata",
"(",
"Collection",
"<",
"MethodMetadata",
"<",
"?",
",",
"?",
">",
">",
"methodMetadataOfType",
")",
"{",
"for",
"(",
"MethodMetadata",
"methodMetadata",
":",
"methodMetadat... | Determine the indexed property from a list of method metadata.
@param methodMetadataOfType
The list of method metadata.
@return The {@link IndexedPropertyMethodMetadata}. | [
"Determine",
"the",
"indexed",
"property",
"from",
"a",
"list",
"of",
"method",
"metadata",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java#L364-L377 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java | MetadataProviderImpl.getMethodMetadataOfType | private Collection<MethodMetadata<?, ?>> getMethodMetadataOfType(AnnotatedType annotatedType, Collection<AnnotatedMethod> annotatedMethods) {
Collection<MethodMetadata<?, ?>> methodMetadataOfType = new ArrayList<>();
// Collect the getter methods as they provide annotations holding meta
// infor... | java | private Collection<MethodMetadata<?, ?>> getMethodMetadataOfType(AnnotatedType annotatedType, Collection<AnnotatedMethod> annotatedMethods) {
Collection<MethodMetadata<?, ?>> methodMetadataOfType = new ArrayList<>();
// Collect the getter methods as they provide annotations holding meta
// infor... | [
"private",
"Collection",
"<",
"MethodMetadata",
"<",
"?",
",",
"?",
">",
">",
"getMethodMetadataOfType",
"(",
"AnnotatedType",
"annotatedType",
",",
"Collection",
"<",
"AnnotatedMethod",
">",
"annotatedMethods",
")",
"{",
"Collection",
"<",
"MethodMetadata",
"<",
... | Return the collection of method metadata from the given collection of
annotated methods.
@param annotatedMethods
The collection of annotated methods.
@return The collection of method metadata. | [
"Return",
"the",
"collection",
"of",
"method",
"metadata",
"from",
"the",
"given",
"collection",
"of",
"annotated",
"methods",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/MetadataProviderImpl.java#L387-L414 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java | DependencyResolver.newInstance | public static <T> DependencyResolver<T> newInstance(Collection<T> elements, DependencyProvider<T> dependencyProvider) {
return new DependencyResolver<T>(elements, dependencyProvider);
} | java | public static <T> DependencyResolver<T> newInstance(Collection<T> elements, DependencyProvider<T> dependencyProvider) {
return new DependencyResolver<T>(elements, dependencyProvider);
} | [
"public",
"static",
"<",
"T",
">",
"DependencyResolver",
"<",
"T",
">",
"newInstance",
"(",
"Collection",
"<",
"T",
">",
"elements",
",",
"DependencyProvider",
"<",
"T",
">",
"dependencyProvider",
")",
"{",
"return",
"new",
"DependencyResolver",
"<",
"T",
">... | Creates an instance of the resolver.
@param elements
The elements to resolve.
@param dependencyProvider
The dependency provider.
@param <T>
The element type.
@return The resolver. | [
"Creates",
"an",
"instance",
"of",
"the",
"resolver",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java#L41-L43 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java | DependencyResolver.resolve | public List<T> resolve() {
blockedBy = new HashMap<>();
Set<T> queue = new LinkedHashSet<>();
Set<T> allElements = new HashSet<>();
queue.addAll(elements);
while (!queue.isEmpty()) {
T element = queue.iterator().next();
Set<T> dependencies = dependencyProv... | java | public List<T> resolve() {
blockedBy = new HashMap<>();
Set<T> queue = new LinkedHashSet<>();
Set<T> allElements = new HashSet<>();
queue.addAll(elements);
while (!queue.isEmpty()) {
T element = queue.iterator().next();
Set<T> dependencies = dependencyProv... | [
"public",
"List",
"<",
"T",
">",
"resolve",
"(",
")",
"{",
"blockedBy",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"Set",
"<",
"T",
">",
"queue",
"=",
"new",
"LinkedHashSet",
"<>",
"(",
")",
";",
"Set",
"<",
"T",
">",
"allElements",
"=",
"new",
... | Resolves the dependencies to a list.
@return The resolved list. | [
"Resolves",
"the",
"dependencies",
"to",
"a",
"list",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java#L50-L68 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java | DependencyResolver.resolve | private void resolve(T element, List<T> result) {
Set<T> dependencies = blockedBy.get(element);
if (dependencies != null) {
for (T dependency : dependencies) {
resolve(dependency, result);
}
blockedBy.remove(element);
result.add(element);
... | java | private void resolve(T element, List<T> result) {
Set<T> dependencies = blockedBy.get(element);
if (dependencies != null) {
for (T dependency : dependencies) {
resolve(dependency, result);
}
blockedBy.remove(element);
result.add(element);
... | [
"private",
"void",
"resolve",
"(",
"T",
"element",
",",
"List",
"<",
"T",
">",
"result",
")",
"{",
"Set",
"<",
"T",
">",
"dependencies",
"=",
"blockedBy",
".",
"get",
"(",
"element",
")",
";",
"if",
"(",
"dependencies",
"!=",
"null",
")",
"{",
"for... | Resolves an element.
@param element
The element.
@param result
The result list. | [
"Resolves",
"an",
"element",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/DependencyResolver.java#L78-L87 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java | TransactionalCache.put | public void put(Id id, Object value, Mode mode) {
if (Mode.WRITE.equals(mode)) {
writeCache.put(id, value);
}
readCache.put(new CacheKey(id), value);
} | java | public void put(Id id, Object value, Mode mode) {
if (Mode.WRITE.equals(mode)) {
writeCache.put(id, value);
}
readCache.put(new CacheKey(id), value);
} | [
"public",
"void",
"put",
"(",
"Id",
"id",
",",
"Object",
"value",
",",
"Mode",
"mode",
")",
"{",
"if",
"(",
"Mode",
".",
"WRITE",
".",
"equals",
"(",
"mode",
")",
")",
"{",
"writeCache",
".",
"put",
"(",
"id",
",",
"value",
")",
";",
"}",
"read... | Put an instance into the cache.
@param id
The id.
@param value
The instance.
@param mode
The mode. | [
"Put",
"an",
"instance",
"into",
"the",
"cache",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java#L66-L71 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java | TransactionalCache.get | public Object get(Id id, Mode mode) {
Object value = writeCache.get(id);
if (value == null) {
value = readCache.get(new CacheKey(id));
if (value != null && Mode.WRITE.equals(mode)) {
writeCache.put(id, value);
}
}
return value;
} | java | public Object get(Id id, Mode mode) {
Object value = writeCache.get(id);
if (value == null) {
value = readCache.get(new CacheKey(id));
if (value != null && Mode.WRITE.equals(mode)) {
writeCache.put(id, value);
}
}
return value;
} | [
"public",
"Object",
"get",
"(",
"Id",
"id",
",",
"Mode",
"mode",
")",
"{",
"Object",
"value",
"=",
"writeCache",
".",
"get",
"(",
"id",
")",
";",
"if",
"(",
"value",
"==",
"null",
")",
"{",
"value",
"=",
"readCache",
".",
"get",
"(",
"new",
"Cach... | Lookup an instance in the cache identified by its id.
@param id
The id.
@param mode
The mode.
@return The corresponding instance or <code>null</code> if no instance is
available. | [
"Lookup",
"an",
"instance",
"in",
"the",
"cache",
"identified",
"by",
"its",
"id",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java#L83-L92 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java | TransactionalCache.remove | public void remove(Id id) {
readCache.remove(new CacheKey(id));
writeCache.remove(id);
} | java | public void remove(Id id) {
readCache.remove(new CacheKey(id));
writeCache.remove(id);
} | [
"public",
"void",
"remove",
"(",
"Id",
"id",
")",
"{",
"readCache",
".",
"remove",
"(",
"new",
"CacheKey",
"(",
"id",
")",
")",
";",
"writeCache",
".",
"remove",
"(",
"id",
")",
";",
"}"
] | Removes an instance from the cache.
@param id
The id. | [
"Removes",
"an",
"instance",
"from",
"the",
"cache",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/cache/TransactionalCache.java#L100-L103 | train |
buschmais/extended-objects | neo4j/remote/src/main/java/com/buschmais/xo/neo4j/remote/impl/datastore/RemoteDatastoreEntityManager.java | RemoteDatastoreEntityManager.initializeEntity | private void initializeEntity(Collection<? extends TypeMetadata> types, NodeState nodeState) {
for (TypeMetadata type : types) {
Collection<TypeMetadata> superTypes = type.getSuperTypes();
initializeEntity(superTypes, nodeState);
for (MethodMetadata<?, ?> methodMetadata : typ... | java | private void initializeEntity(Collection<? extends TypeMetadata> types, NodeState nodeState) {
for (TypeMetadata type : types) {
Collection<TypeMetadata> superTypes = type.getSuperTypes();
initializeEntity(superTypes, nodeState);
for (MethodMetadata<?, ?> methodMetadata : typ... | [
"private",
"void",
"initializeEntity",
"(",
"Collection",
"<",
"?",
"extends",
"TypeMetadata",
">",
"types",
",",
"NodeState",
"nodeState",
")",
"{",
"for",
"(",
"TypeMetadata",
"type",
":",
"types",
")",
"{",
"Collection",
"<",
"TypeMetadata",
">",
"superType... | Initializes all relation properties of the given node state with empty
collections.
@param types
The types.
@param nodeState
The state of the entity. | [
"Initializes",
"all",
"relation",
"properties",
"of",
"the",
"given",
"node",
"state",
"with",
"empty",
"collections",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/neo4j/remote/src/main/java/com/buschmais/xo/neo4j/remote/impl/datastore/RemoteDatastoreEntityManager.java#L106-L134 | train |
buschmais/extended-objects | trace/src/main/java/com/buschmais/xo/trace/impl/TraceMonitor.java | TraceMonitor.log | public void log(String message) {
switch (level) {
case TRACE:
LOGGER.trace(message);
break;
case DEBUG:
LOGGER.debug(message);
break;
case INFO:
LOGGER.info(message);
break;
case WARN:
LOGGER.war... | java | public void log(String message) {
switch (level) {
case TRACE:
LOGGER.trace(message);
break;
case DEBUG:
LOGGER.debug(message);
break;
case INFO:
LOGGER.info(message);
break;
case WARN:
LOGGER.war... | [
"public",
"void",
"log",
"(",
"String",
"message",
")",
"{",
"switch",
"(",
"level",
")",
"{",
"case",
"TRACE",
":",
"LOGGER",
".",
"trace",
"(",
"message",
")",
";",
"break",
";",
"case",
"DEBUG",
":",
"LOGGER",
".",
"debug",
"(",
"message",
")",
... | Log a message using the configured log level.
@param message
The message. | [
"Log",
"a",
"message",
"using",
"the",
"configured",
"log",
"level",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/trace/src/main/java/com/buschmais/xo/trace/impl/TraceMonitor.java#L121-L141 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/query/XOQueryImpl.java | XOQueryImpl.convertParameter | private Object convertParameter(Object value) {
if (entityInstanceManager.isInstance(value)) {
return entityInstanceManager.getDatastoreType(value);
} else if (relationInstanceManager.isInstance(value)) {
return relationInstanceManager.getDatastoreType(value);
} else if (... | java | private Object convertParameter(Object value) {
if (entityInstanceManager.isInstance(value)) {
return entityInstanceManager.getDatastoreType(value);
} else if (relationInstanceManager.isInstance(value)) {
return relationInstanceManager.getDatastoreType(value);
} else if (... | [
"private",
"Object",
"convertParameter",
"(",
"Object",
"value",
")",
"{",
"if",
"(",
"entityInstanceManager",
".",
"isInstance",
"(",
"value",
")",
")",
"{",
"return",
"entityInstanceManager",
".",
"getDatastoreType",
"(",
"value",
")",
";",
"}",
"else",
"if"... | Converts the given parameter value to instances which can be passed to the
datastore.
@param value
The value.
@return The converted value. | [
"Converts",
"the",
"given",
"parameter",
"value",
"to",
"instances",
"which",
"can",
"be",
"passed",
"to",
"the",
"datastore",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/query/XOQueryImpl.java#L168-L182 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/plugin/PluginRepositoryManager.java | PluginRepositoryManager.getPluginManager | public <P extends PluginRepository<?, ?>> P getPluginManager(Class<?> pluginType) {
return (P) pluginRepositories.get(pluginType);
} | java | public <P extends PluginRepository<?, ?>> P getPluginManager(Class<?> pluginType) {
return (P) pluginRepositories.get(pluginType);
} | [
"public",
"<",
"P",
"extends",
"PluginRepository",
"<",
"?",
",",
"?",
">",
">",
"P",
"getPluginManager",
"(",
"Class",
"<",
"?",
">",
"pluginType",
")",
"{",
"return",
"(",
"P",
")",
"pluginRepositories",
".",
"get",
"(",
"pluginType",
")",
";",
"}"
] | Return a plugin repository identified by the plugin interface type.
@param pluginType
The plugin interface.
@param <P>
The plugin type
@return The {@link com.buschmais.xo.impl.plugin.PluginRepository}. | [
"Return",
"a",
"plugin",
"repository",
"identified",
"by",
"the",
"plugin",
"interface",
"type",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/plugin/PluginRepositoryManager.java#L44-L46 | train |
buschmais/extended-objects | neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java | AbstractNeo4jDatastore.ensureIndex | private void ensureIndex(DS session, EntityTypeMetadata<NodeMetadata<L>> entityTypeMetadata,
IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedProperty) {
if (indexedProperty != null) {
IndexedPropertyMetadata datastoreMetadata = indexedProperty.getDatastoreMetadata();
... | java | private void ensureIndex(DS session, EntityTypeMetadata<NodeMetadata<L>> entityTypeMetadata,
IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedProperty) {
if (indexedProperty != null) {
IndexedPropertyMetadata datastoreMetadata = indexedProperty.getDatastoreMetadata();
... | [
"private",
"void",
"ensureIndex",
"(",
"DS",
"session",
",",
"EntityTypeMetadata",
"<",
"NodeMetadata",
"<",
"L",
">",
">",
"entityTypeMetadata",
",",
"IndexedPropertyMethodMetadata",
"<",
"IndexedPropertyMetadata",
">",
"indexedProperty",
")",
"{",
"if",
"(",
"inde... | Ensures that an index exists for the given entity and property.
@param entityTypeMetadata
The entity.
@param indexedProperty
The index metadata. | [
"Ensures",
"that",
"an",
"index",
"exists",
"for",
"the",
"given",
"entity",
"and",
"property",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java#L56-L68 | train |
buschmais/extended-objects | neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java | AbstractNeo4jDatastore.ensureIndex | private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
String statement;
if (unique) {
LOGGER.debug("Creating constrai... | java | private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
String statement;
if (unique) {
LOGGER.debug("Creating constrai... | [
"private",
"void",
"ensureIndex",
"(",
"DS",
"session",
",",
"L",
"label",
",",
"PrimitivePropertyMethodMetadata",
"<",
"PropertyMetadata",
">",
"propertyMethodMetadata",
",",
"boolean",
"unique",
")",
"{",
"PropertyMetadata",
"propertyMetadata",
"=",
"propertyMethodMet... | Ensures that an index exists for the given label and property.
@param session
The datastore session
@param label
The label.
@param propertyMethodMetadata
The property metadata.
@param unique
if <code>true</code> create a unique constraint | [
"Ensures",
"that",
"an",
"index",
"exists",
"for",
"the",
"given",
"label",
"and",
"property",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/neo4j/spi/src/main/java/com/buschmais/xo/neo4j/spi/AbstractNeo4jDatastore.java#L82-L94 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/datastore/DynamicType.java | DynamicType.getCompositeType | public CompositeType getCompositeType() {
return CompositeTypeBuilder.create(CompositeObject.class, metadata, typeMetadata -> typeMetadata.getAnnotatedType().getAnnotatedElement());
} | java | public CompositeType getCompositeType() {
return CompositeTypeBuilder.create(CompositeObject.class, metadata, typeMetadata -> typeMetadata.getAnnotatedType().getAnnotatedElement());
} | [
"public",
"CompositeType",
"getCompositeType",
"(",
")",
"{",
"return",
"CompositeTypeBuilder",
".",
"create",
"(",
"CompositeObject",
".",
"class",
",",
"metadata",
",",
"typeMetadata",
"->",
"typeMetadata",
".",
"getAnnotatedType",
"(",
")",
".",
"getAnnotatedElem... | Convert this set into a composite type.
@return The composite type. | [
"Convert",
"this",
"set",
"into",
"a",
"composite",
"type",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/datastore/DynamicType.java#L43-L45 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java | InstanceListenerService.registerInstanceListener | public void registerInstanceListener(Object instanceListener) {
for (Method method : instanceListener.getClass().getMethods()) {
evaluateMethod(instanceListener, PostCreate.class, method, postCreateMethods);
evaluateMethod(instanceListener, PreUpdate.class, method, preUpdateMethods);
... | java | public void registerInstanceListener(Object instanceListener) {
for (Method method : instanceListener.getClass().getMethods()) {
evaluateMethod(instanceListener, PostCreate.class, method, postCreateMethods);
evaluateMethod(instanceListener, PreUpdate.class, method, preUpdateMethods);
... | [
"public",
"void",
"registerInstanceListener",
"(",
"Object",
"instanceListener",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"instanceListener",
".",
"getClass",
"(",
")",
".",
"getMethods",
"(",
")",
")",
"{",
"evaluateMethod",
"(",
"instanceListener",
",",
... | Add an instance listener instance.
@param instanceListener
The instance listener instance. | [
"Add",
"an",
"instance",
"listener",
"instance",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java#L121-L130 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java | InstanceListenerService.evaluateMethod | private void evaluateMethod(Object listener, Class<? extends Annotation> annotation, Method method, Map<Object, Set<Method>> methods) {
if (method.isAnnotationPresent(annotation)) {
if (method.getParameterTypes().length != 1) {
throw new XOException("Life cycle method '" + method.toG... | java | private void evaluateMethod(Object listener, Class<? extends Annotation> annotation, Method method, Map<Object, Set<Method>> methods) {
if (method.isAnnotationPresent(annotation)) {
if (method.getParameterTypes().length != 1) {
throw new XOException("Life cycle method '" + method.toG... | [
"private",
"void",
"evaluateMethod",
"(",
"Object",
"listener",
",",
"Class",
"<",
"?",
"extends",
"Annotation",
">",
"annotation",
",",
"Method",
"method",
",",
"Map",
"<",
"Object",
",",
"Set",
"<",
"Method",
">",
">",
"methods",
")",
"{",
"if",
"(",
... | Evaluates a method if an annotation is present and if true adds to the map of
life cycle methods.
@param listener
The listener instance.
@param annotation
The annotation to check for.
@param method
The method to evaluate.
@param methods
The map of methods. | [
"Evaluates",
"a",
"method",
"if",
"an",
"annotation",
"is",
"present",
"and",
"if",
"true",
"adds",
"to",
"the",
"map",
"of",
"life",
"cycle",
"methods",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java#L145-L158 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java | InstanceListenerService.invoke | private <T> void invoke(Map<Object, Set<Method>> methods, T instance) {
for (Map.Entry<Object, Set<Method>> entry : methods.entrySet()) {
Object listener = entry.getKey();
Set<Method> listenerMethods = entry.getValue();
if (listenerMethods != null) {
for (Meth... | java | private <T> void invoke(Map<Object, Set<Method>> methods, T instance) {
for (Map.Entry<Object, Set<Method>> entry : methods.entrySet()) {
Object listener = entry.getKey();
Set<Method> listenerMethods = entry.getValue();
if (listenerMethods != null) {
for (Meth... | [
"private",
"<",
"T",
">",
"void",
"invoke",
"(",
"Map",
"<",
"Object",
",",
"Set",
"<",
"Method",
">",
">",
"methods",
",",
"T",
"instance",
")",
"{",
"for",
"(",
"Map",
".",
"Entry",
"<",
"Object",
",",
"Set",
"<",
"Method",
">",
">",
"entry",
... | Invokes all registered lifecycle methods on a given instance.
@param methods
The registered methods.
@param instance
The instance.
@param <T>
The instance type. | [
"Invokes",
"all",
"registered",
"lifecycle",
"methods",
"on",
"a",
"given",
"instance",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/instancelistener/InstanceListenerService.java#L170-L189 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.readInstance | @Override
public <T> T readInstance(DatastoreType datastoreType) {
return getInstance(datastoreType, TransactionalCache.Mode.READ);
} | java | @Override
public <T> T readInstance(DatastoreType datastoreType) {
return getInstance(datastoreType, TransactionalCache.Mode.READ);
} | [
"@",
"Override",
"public",
"<",
"T",
">",
"T",
"readInstance",
"(",
"DatastoreType",
"datastoreType",
")",
"{",
"return",
"getInstance",
"(",
"datastoreType",
",",
"TransactionalCache",
".",
"Mode",
".",
"READ",
")",
";",
"}"
] | Return the proxy instance which corresponds to the given datastore type for
reading.
@param datastoreType
The datastore type.
@param <T>
The instance type.
@return The instance. | [
"Return",
"the",
"proxy",
"instance",
"which",
"corresponds",
"to",
"the",
"given",
"datastore",
"type",
"for",
"reading",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L54-L57 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.createInstance | public <T> T createInstance(DatastoreType datastoreType, DynamicType<?> types) {
return newInstance(getDatastoreId(datastoreType), datastoreType, types, TransactionalCache.Mode.WRITE);
} | java | public <T> T createInstance(DatastoreType datastoreType, DynamicType<?> types) {
return newInstance(getDatastoreId(datastoreType), datastoreType, types, TransactionalCache.Mode.WRITE);
} | [
"public",
"<",
"T",
">",
"T",
"createInstance",
"(",
"DatastoreType",
"datastoreType",
",",
"DynamicType",
"<",
"?",
">",
"types",
")",
"{",
"return",
"newInstance",
"(",
"getDatastoreId",
"(",
"datastoreType",
")",
",",
"datastoreType",
",",
"types",
",",
"... | Return the proxy instance which corresponds to the given datastore type for
writing.
@param datastoreType
The datastore type.
@param types
The {@link DynamicType}.
@param <T>
The instance type.
@return The instance. | [
"Return",
"the",
"proxy",
"instance",
"which",
"corresponds",
"to",
"the",
"given",
"datastore",
"type",
"for",
"writing",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L71-L73 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.getInstance | private <T> T getInstance(DatastoreType datastoreType, TransactionalCache.Mode cacheMode) {
DatastoreId id = getDatastoreId(datastoreType);
Object instance = cache.get(id, cacheMode);
if (instance == null) {
DynamicType<?> types = getTypes(datastoreType);
instance = newIn... | java | private <T> T getInstance(DatastoreType datastoreType, TransactionalCache.Mode cacheMode) {
DatastoreId id = getDatastoreId(datastoreType);
Object instance = cache.get(id, cacheMode);
if (instance == null) {
DynamicType<?> types = getTypes(datastoreType);
instance = newIn... | [
"private",
"<",
"T",
">",
"T",
"getInstance",
"(",
"DatastoreType",
"datastoreType",
",",
"TransactionalCache",
".",
"Mode",
"cacheMode",
")",
"{",
"DatastoreId",
"id",
"=",
"getDatastoreId",
"(",
"datastoreType",
")",
";",
"Object",
"instance",
"=",
"cache",
... | Return the proxy instance which corresponds to the given datastore type.
@param datastoreType
The datastore type.
@param <T>
The instance type.
@return The instance. | [
"Return",
"the",
"proxy",
"instance",
"which",
"corresponds",
"to",
"the",
"given",
"datastore",
"type",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L89-L100 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.newInstance | private <T> T newInstance(DatastoreId id, DatastoreType datastoreType, DynamicType<?> types, TransactionalCache.Mode cacheMode) {
validateType(types);
InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(datastoreType, getProxyMethodService());
T instance = proxyFactory.cr... | java | private <T> T newInstance(DatastoreId id, DatastoreType datastoreType, DynamicType<?> types, TransactionalCache.Mode cacheMode) {
validateType(types);
InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(datastoreType, getProxyMethodService());
T instance = proxyFactory.cr... | [
"private",
"<",
"T",
">",
"T",
"newInstance",
"(",
"DatastoreId",
"id",
",",
"DatastoreType",
"datastoreType",
",",
"DynamicType",
"<",
"?",
">",
"types",
",",
"TransactionalCache",
".",
"Mode",
"cacheMode",
")",
"{",
"validateType",
"(",
"types",
")",
";",
... | Create a proxy instance which corresponds to the given datastore type.
@param datastoreType
The datastore type.
@param <T>
The instance type.
@return The instance. | [
"Create",
"a",
"proxy",
"instance",
"which",
"corresponds",
"to",
"the",
"given",
"datastore",
"type",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L111-L117 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.validateType | private void validateType(DynamicType<?> dynamicType) {
int size = dynamicType.getMetadata().size();
if (size == 1) {
if (dynamicType.isAbstract()) {
throw new XOException("Cannot create an instance of a single abstract type " + dynamicType);
}
} else if (... | java | private void validateType(DynamicType<?> dynamicType) {
int size = dynamicType.getMetadata().size();
if (size == 1) {
if (dynamicType.isAbstract()) {
throw new XOException("Cannot create an instance of a single abstract type " + dynamicType);
}
} else if (... | [
"private",
"void",
"validateType",
"(",
"DynamicType",
"<",
"?",
">",
"dynamicType",
")",
"{",
"int",
"size",
"=",
"dynamicType",
".",
"getMetadata",
"(",
")",
".",
"size",
"(",
")",
";",
"if",
"(",
"size",
"==",
"1",
")",
"{",
"if",
"(",
"dynamicTyp... | Validates the given types.
@param dynamicType
The types. | [
"Validates",
"the",
"given",
"types",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L125-L134 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.isInstance | @Override
public <Instance> boolean isInstance(Instance instance) {
if (instance instanceof CompositeObject) {
Object delegate = ((CompositeObject) instance).getDelegate();
return isDatastoreType(delegate);
}
return false;
} | java | @Override
public <Instance> boolean isInstance(Instance instance) {
if (instance instanceof CompositeObject) {
Object delegate = ((CompositeObject) instance).getDelegate();
return isDatastoreType(delegate);
}
return false;
} | [
"@",
"Override",
"public",
"<",
"Instance",
">",
"boolean",
"isInstance",
"(",
"Instance",
"instance",
")",
"{",
"if",
"(",
"instance",
"instanceof",
"CompositeObject",
")",
"{",
"Object",
"delegate",
"=",
"(",
"(",
"CompositeObject",
")",
"instance",
")",
"... | Determine if a given instance is a datastore type handled by this manager.
@param instance
The instance.
@param <Instance>
The instance type.
@return <code>true</code> if the instance is handled by this manager. | [
"Determine",
"if",
"a",
"given",
"instance",
"is",
"a",
"datastore",
"type",
"handled",
"by",
"this",
"manager",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L173-L180 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java | AbstractInstanceManager.getDatastoreType | @Override
public <Instance> DatastoreType getDatastoreType(Instance instance) {
InstanceInvocationHandler<DatastoreType> invocationHandler = proxyFactory.getInvocationHandler(instance);
return invocationHandler.getDatastoreType();
} | java | @Override
public <Instance> DatastoreType getDatastoreType(Instance instance) {
InstanceInvocationHandler<DatastoreType> invocationHandler = proxyFactory.getInvocationHandler(instance);
return invocationHandler.getDatastoreType();
} | [
"@",
"Override",
"public",
"<",
"Instance",
">",
"DatastoreType",
"getDatastoreType",
"(",
"Instance",
"instance",
")",
"{",
"InstanceInvocationHandler",
"<",
"DatastoreType",
">",
"invocationHandler",
"=",
"proxyFactory",
".",
"getInvocationHandler",
"(",
"instance",
... | Return the datastore type represented by an instance.
@param instance
The instance.
@param <Instance>
The instance type.
@return The corresponding datastore type. | [
"Return",
"the",
"datastore",
"type",
"represented",
"by",
"an",
"instance",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/AbstractInstanceManager.java#L191-L195 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/RelationTypeMetadataResolver.java | RelationTypeMetadataResolver.getRelationTypes | public DynamicType<RelationTypeMetadata<RelationMetadata>> getRelationTypes(Set<EntityDiscriminator> sourceDiscriminators,
RelationDiscriminator discriminator, Set<EntityDiscriminator> targetDiscriminators) {
DynamicType<RelationTypeMetadata<RelationMetadata>> dynamicType = new DynamicType<>();
... | java | public DynamicType<RelationTypeMetadata<RelationMetadata>> getRelationTypes(Set<EntityDiscriminator> sourceDiscriminators,
RelationDiscriminator discriminator, Set<EntityDiscriminator> targetDiscriminators) {
DynamicType<RelationTypeMetadata<RelationMetadata>> dynamicType = new DynamicType<>();
... | [
"public",
"DynamicType",
"<",
"RelationTypeMetadata",
"<",
"RelationMetadata",
">",
">",
"getRelationTypes",
"(",
"Set",
"<",
"EntityDiscriminator",
">",
"sourceDiscriminators",
",",
"RelationDiscriminator",
"discriminator",
",",
"Set",
"<",
"EntityDiscriminator",
">",
... | Determine the relation type for the given source discriminators, relation
descriminator and target discriminators.
@param sourceDiscriminators
The source discriminators.
@param discriminator
The relation discriminator.
@param targetDiscriminators
The target discriminators.
@return A set of matching relation types. | [
"Determine",
"the",
"relation",
"type",
"for",
"the",
"given",
"source",
"discriminators",
"relation",
"descriminator",
"and",
"target",
"discriminators",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/RelationTypeMetadataResolver.java#L91-L108 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/XOManagerImpl.java | XOManagerImpl.prepareExample | private <T> Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> prepareExample(Example<T> example, Class<?> type, Class<?>... types) {
Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> exampleEntity = new HashMap<>();
ExampleProxyMethodService<T> proxyMethodService = (ExampleProx... | java | private <T> Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> prepareExample(Example<T> example, Class<?> type, Class<?>... types) {
Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> exampleEntity = new HashMap<>();
ExampleProxyMethodService<T> proxyMethodService = (ExampleProx... | [
"private",
"<",
"T",
">",
"Map",
"<",
"PrimitivePropertyMethodMetadata",
"<",
"PropertyMetadata",
">",
",",
"Object",
">",
"prepareExample",
"(",
"Example",
"<",
"T",
">",
"example",
",",
"Class",
"<",
"?",
">",
"type",
",",
"Class",
"<",
"?",
">",
"..."... | Setup an example entity.
@param type
The type.
@param example
The provided example.
@param <T>
The type.
@return The example. | [
"Setup",
"an",
"example",
"entity",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/XOManagerImpl.java#L149-L164 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/XOManagerImpl.java | XOManagerImpl.findByExample | private <T> ResultIterable<T> findByExample(Class<?> type, Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> entity) {
sessionContext.getCacheSynchronizationService().flush();
EntityTypeMetadata<EntityMetadata> entityTypeMetadata = sessionContext.getMetadataProvider().getEntityMetadata(type... | java | private <T> ResultIterable<T> findByExample(Class<?> type, Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> entity) {
sessionContext.getCacheSynchronizationService().flush();
EntityTypeMetadata<EntityMetadata> entityTypeMetadata = sessionContext.getMetadataProvider().getEntityMetadata(type... | [
"private",
"<",
"T",
">",
"ResultIterable",
"<",
"T",
">",
"findByExample",
"(",
"Class",
"<",
"?",
">",
"type",
",",
"Map",
"<",
"PrimitivePropertyMethodMetadata",
"<",
"PropertyMetadata",
">",
",",
"Object",
">",
"entity",
")",
"{",
"sessionContext",
".",
... | Find entities according to the given example entity.
@param type
The entity type.
@param entity
The example entity.
@param <T>
The entity type.
@return A {@link ResultIterable}. | [
"Find",
"entities",
"according",
"to",
"the",
"given",
"example",
"entity",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/XOManagerImpl.java#L177-L219 | train |
buschmais/extended-objects | impl/src/main/java/com/buschmais/xo/impl/metadata/EntityTypeMetadataResolver.java | EntityTypeMetadataResolver.getAggregatedDiscriminators | private Set<Discriminator> getAggregatedDiscriminators(EntityTypeMetadata<EntityMetadata> typeMetadata) {
Set<Discriminator> discriminators = aggregatedDiscriminators.get(typeMetadata);
if (discriminators == null) {
discriminators = new HashSet<>();
Discriminator discriminator = ... | java | private Set<Discriminator> getAggregatedDiscriminators(EntityTypeMetadata<EntityMetadata> typeMetadata) {
Set<Discriminator> discriminators = aggregatedDiscriminators.get(typeMetadata);
if (discriminators == null) {
discriminators = new HashSet<>();
Discriminator discriminator = ... | [
"private",
"Set",
"<",
"Discriminator",
">",
"getAggregatedDiscriminators",
"(",
"EntityTypeMetadata",
"<",
"EntityMetadata",
">",
"typeMetadata",
")",
"{",
"Set",
"<",
"Discriminator",
">",
"discriminators",
"=",
"aggregatedDiscriminators",
".",
"get",
"(",
"typeMeta... | Determine the set of discriminators for one type, i.e. the discriminator of
the type itself and of all it's super types.
@param typeMetadata
The type.
@return The set of discriminators. | [
"Determine",
"the",
"set",
"of",
"discriminators",
"for",
"one",
"type",
"i",
".",
"e",
".",
"the",
"discriminator",
"of",
"the",
"type",
"itself",
"and",
"of",
"all",
"it",
"s",
"super",
"types",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/impl/src/main/java/com/buschmais/xo/impl/metadata/EntityTypeMetadataResolver.java#L136-L153 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java | ClassHelper.getTypes | public static Collection<Class<?>> getTypes(Collection<String> typeNames) {
Set<Class<?>> types = new HashSet<>();
for (String typeName : typeNames) {
types.add(ClassHelper.getType(typeName));
}
return types;
} | java | public static Collection<Class<?>> getTypes(Collection<String> typeNames) {
Set<Class<?>> types = new HashSet<>();
for (String typeName : typeNames) {
types.add(ClassHelper.getType(typeName));
}
return types;
} | [
"public",
"static",
"Collection",
"<",
"Class",
"<",
"?",
">",
">",
"getTypes",
"(",
"Collection",
"<",
"String",
">",
"typeNames",
")",
"{",
"Set",
"<",
"Class",
"<",
"?",
">",
">",
"types",
"=",
"new",
"HashSet",
"<>",
"(",
")",
";",
"for",
"(",
... | Load a collection of classes.
@param typeNames
The class names.
@return The collection of classes. | [
"Load",
"a",
"collection",
"of",
"classes",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java#L48-L54 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java | ClassHelper.newInstance | public static <T> T newInstance(Class<T> type) {
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new XOException("Cannot create instance of type '" + type.getName() + "'", e);
} catch (IllegalAccessException e) {
throw new XOExcepti... | java | public static <T> T newInstance(Class<T> type) {
try {
return type.newInstance();
} catch (InstantiationException e) {
throw new XOException("Cannot create instance of type '" + type.getName() + "'", e);
} catch (IllegalAccessException e) {
throw new XOExcepti... | [
"public",
"static",
"<",
"T",
">",
"T",
"newInstance",
"(",
"Class",
"<",
"T",
">",
"type",
")",
"{",
"try",
"{",
"return",
"type",
".",
"newInstance",
"(",
")",
";",
"}",
"catch",
"(",
"InstantiationException",
"e",
")",
"{",
"throw",
"new",
"XOExce... | Create an instance of a class.
@param type
The class.
@param <T>
The class type.
@return The instance. | [
"Create",
"an",
"instance",
"of",
"a",
"class",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java#L65-L73 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java | ClassHelper.getTypeParameter | public static Class<?> getTypeParameter(Class<?> genericType, Class<?> type) {
Type[] genericInterfaces = type.getGenericInterfaces();
for (Type genericInterface : genericInterfaces) {
if (genericInterface instanceof ParameterizedType) {
ParameterizedType parameterizedType = ... | java | public static Class<?> getTypeParameter(Class<?> genericType, Class<?> type) {
Type[] genericInterfaces = type.getGenericInterfaces();
for (Type genericInterface : genericInterfaces) {
if (genericInterface instanceof ParameterizedType) {
ParameterizedType parameterizedType = ... | [
"public",
"static",
"Class",
"<",
"?",
">",
"getTypeParameter",
"(",
"Class",
"<",
"?",
">",
"genericType",
",",
"Class",
"<",
"?",
">",
"type",
")",
"{",
"Type",
"[",
"]",
"genericInterfaces",
"=",
"type",
".",
"getGenericInterfaces",
"(",
")",
";",
"... | Determines the type of a class implementing a generic interface with one type
parameter.
@param genericType
The generic interface type.
@param type
The type to determine the parameter from.
@return The type parameter. | [
"Determines",
"the",
"type",
"of",
"a",
"class",
"implementing",
"a",
"generic",
"interface",
"with",
"one",
"type",
"parameter",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/ClassHelper.java#L85-L99 | train |
buschmais/extended-objects | spi/src/main/java/com/buschmais/xo/spi/reflection/BeanMethodProvider.java | BeanMethodProvider.getMethods | public Collection<AnnotatedMethod> getMethods() {
for (Method method : type.getDeclaredMethods()) {
// only consider methods which have been explicitly declared in the
// interface
if (!method.isSynthetic()) {
Class<?> returnType = method.getReturnType();
... | java | public Collection<AnnotatedMethod> getMethods() {
for (Method method : type.getDeclaredMethods()) {
// only consider methods which have been explicitly declared in the
// interface
if (!method.isSynthetic()) {
Class<?> returnType = method.getReturnType();
... | [
"public",
"Collection",
"<",
"AnnotatedMethod",
">",
"getMethods",
"(",
")",
"{",
"for",
"(",
"Method",
"method",
":",
"type",
".",
"getDeclaredMethods",
"(",
")",
")",
"{",
"// only consider methods which have been explicitly declared in the",
"// interface",
"if",
"... | Return the methods of the type.
@return The methods. | [
"Return",
"the",
"methods",
"of",
"the",
"type",
"."
] | 186431e81f3d8d26c511cfe1143dee59b03c2e7a | https://github.com/buschmais/extended-objects/blob/186431e81f3d8d26c511cfe1143dee59b03c2e7a/spi/src/main/java/com/buschmais/xo/spi/reflection/BeanMethodProvider.java#L76-L126 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.rewriteAnchor | private List<Content> rewriteAnchor(Element element) {
// detect empty anchor elements and insert at least an empty string to avoid "self-closing" elements
// that are not handled correctly by most browsers
if (element.getContent().isEmpty()) {
element.setText("");
}
// resolve link metadata... | java | private List<Content> rewriteAnchor(Element element) {
// detect empty anchor elements and insert at least an empty string to avoid "self-closing" elements
// that are not handled correctly by most browsers
if (element.getContent().isEmpty()) {
element.setText("");
}
// resolve link metadata... | [
"private",
"List",
"<",
"Content",
">",
"rewriteAnchor",
"(",
"Element",
"element",
")",
"{",
"// detect empty anchor elements and insert at least an empty string to avoid \"self-closing\" elements",
"// that are not handled correctly by most browsers",
"if",
"(",
"element",
".",
"... | Checks if the given anchor element has to be rewritten.
@param element Element to check
@return null if nothing is to do with this element.
Return empty list to remove this element.
Return list with other content to replace element with new content. | [
"Checks",
"if",
"the",
"given",
"anchor",
"element",
"has",
"to",
"be",
"rewritten",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L151-L175 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.getAnchorLegacyMetadataFromSingleData | private boolean getAnchorLegacyMetadataFromSingleData(ValueMap resourceProps, Element element) {
boolean foundAny = false;
JSONObject metadata = null;
Attribute dataAttribute = element.getAttribute("data");
if (dataAttribute != null) {
String metadataString = dataAttribute.getValue();
if (S... | java | private boolean getAnchorLegacyMetadataFromSingleData(ValueMap resourceProps, Element element) {
boolean foundAny = false;
JSONObject metadata = null;
Attribute dataAttribute = element.getAttribute("data");
if (dataAttribute != null) {
String metadataString = dataAttribute.getValue();
if (S... | [
"private",
"boolean",
"getAnchorLegacyMetadataFromSingleData",
"(",
"ValueMap",
"resourceProps",
",",
"Element",
"element",
")",
"{",
"boolean",
"foundAny",
"=",
"false",
";",
"JSONObject",
"metadata",
"=",
"null",
";",
"Attribute",
"dataAttribute",
"=",
"element",
... | Support legacy data structures where link metadata is stored as JSON fragment in single HTML5 data attribute.
@param resourceProps ValueMap to write link metadata to
@param element Link element | [
"Support",
"legacy",
"data",
"structures",
"where",
"link",
"metadata",
"is",
"stored",
"as",
"JSON",
"fragment",
"in",
"single",
"HTML5",
"data",
"attribute",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L257-L283 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.getAnchorLegacyMetadataFromRel | private void getAnchorLegacyMetadataFromRel(ValueMap resourceProps, Element element) {
// Check href attribute - do not change elements with no href or links to anchor names
String href = element.getAttributeValue("href");
String linkWindowTarget = element.getAttributeValue("target");
if (href == null |... | java | private void getAnchorLegacyMetadataFromRel(ValueMap resourceProps, Element element) {
// Check href attribute - do not change elements with no href or links to anchor names
String href = element.getAttributeValue("href");
String linkWindowTarget = element.getAttributeValue("target");
if (href == null |... | [
"private",
"void",
"getAnchorLegacyMetadataFromRel",
"(",
"ValueMap",
"resourceProps",
",",
"Element",
"element",
")",
"{",
"// Check href attribute - do not change elements with no href or links to anchor names",
"String",
"href",
"=",
"element",
".",
"getAttributeValue",
"(",
... | Support legacy data structures where link metadata is stored as JSON fragment in rel attribute.
@param resourceProps ValueMap to write link metadata to
@param element Link element | [
"Support",
"legacy",
"data",
"structures",
"where",
"link",
"metadata",
"is",
"stored",
"as",
"JSON",
"fragment",
"in",
"rel",
"attribute",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L290-L372 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.rewriteImage | private List<Content> rewriteImage(Element element) {
// resolve media metadata from DOM element
Media media = getImageMedia(element);
// build image for media metadata
Element imageElement = buildImageElement(media, element);
// return modified element
List<Content> content = new ArrayList<C... | java | private List<Content> rewriteImage(Element element) {
// resolve media metadata from DOM element
Media media = getImageMedia(element);
// build image for media metadata
Element imageElement = buildImageElement(media, element);
// return modified element
List<Content> content = new ArrayList<C... | [
"private",
"List",
"<",
"Content",
">",
"rewriteImage",
"(",
"Element",
"element",
")",
"{",
"// resolve media metadata from DOM element",
"Media",
"media",
"=",
"getImageMedia",
"(",
"element",
")",
";",
"// build image for media metadata",
"Element",
"imageElement",
"... | Checks if the given image element has to be rewritten.
@param element Element to check
@return null if nothing is to do with this element.
Return empty list to remove this element.
Return list with other content to replace element with new content. | [
"Checks",
"if",
"the",
"given",
"image",
"element",
"has",
"to",
"be",
"rewritten",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L381-L395 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.buildImageElement | private Element buildImageElement(Media media, Element element) {
if (media.isValid()) {
element.setAttribute("src", media.getUrl());
}
return element;
} | java | private Element buildImageElement(Media media, Element element) {
if (media.isValid()) {
element.setAttribute("src", media.getUrl());
}
return element;
} | [
"private",
"Element",
"buildImageElement",
"(",
"Media",
"media",
",",
"Element",
"element",
")",
"{",
"if",
"(",
"media",
".",
"isValid",
"(",
")",
")",
"{",
"element",
".",
"setAttribute",
"(",
"\"src\"",
",",
"media",
".",
"getUrl",
"(",
")",
")",
"... | Builds image element for given media metadata.
@param media Media metadata
@param element Original element
@return Image element or null if media reference is invalid | [
"Builds",
"image",
"element",
"for",
"given",
"media",
"metadata",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L416-L421 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.unexternalizeImageRef | private String unexternalizeImageRef(String ref) {
String unexternalizedRef = ref;
if (StringUtils.isNotEmpty(unexternalizedRef)) {
// decode if required
unexternalizedRef = decodeIfEncoded(unexternalizedRef);
// TODO: implementation has to be aligned with MediaSource implementations!
... | java | private String unexternalizeImageRef(String ref) {
String unexternalizedRef = ref;
if (StringUtils.isNotEmpty(unexternalizedRef)) {
// decode if required
unexternalizedRef = decodeIfEncoded(unexternalizedRef);
// TODO: implementation has to be aligned with MediaSource implementations!
... | [
"private",
"String",
"unexternalizeImageRef",
"(",
"String",
"ref",
")",
"{",
"String",
"unexternalizedRef",
"=",
"ref",
";",
"if",
"(",
"StringUtils",
".",
"isNotEmpty",
"(",
"unexternalizedRef",
")",
")",
"{",
"// decode if required",
"unexternalizedRef",
"=",
"... | Converts the RTE externalized form of media reference to internal form.
@param ref Externalize media reference
@return Internal media reference | [
"Converts",
"the",
"RTE",
"externalized",
"form",
"of",
"media",
"reference",
"to",
"internal",
"form",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L428-L443 | train |
wcm-io/wcm-io-handler | richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java | DefaultRewriteContentHandler.decodeIfEncoded | private String decodeIfEncoded(String value) {
if (StringUtils.contains(value, "%")) {
try {
return URLDecoder.decode(value, CharEncoding.UTF_8);
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex);
}
}
return value;
} | java | private String decodeIfEncoded(String value) {
if (StringUtils.contains(value, "%")) {
try {
return URLDecoder.decode(value, CharEncoding.UTF_8);
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException(ex);
}
}
return value;
} | [
"private",
"String",
"decodeIfEncoded",
"(",
"String",
"value",
")",
"{",
"if",
"(",
"StringUtils",
".",
"contains",
"(",
"value",
",",
"\"%\"",
")",
")",
"{",
"try",
"{",
"return",
"URLDecoder",
".",
"decode",
"(",
"value",
",",
"CharEncoding",
".",
"UT... | URL-decode value if required.
@param value Probably encoded value.
@return Decoded value | [
"URL",
"-",
"decode",
"value",
"if",
"required",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/richtext/src/main/java/io/wcm/handler/richtext/DefaultRewriteContentHandler.java#L450-L460 | train |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/suffix/impl/UrlSuffixUtil.java | UrlSuffixUtil.keyValuePairAsMap | public static Map<String, Object> keyValuePairAsMap(String key, Object value) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(key, value);
return paramMap;
} | java | public static Map<String, Object> keyValuePairAsMap(String key, Object value) {
Map<String, Object> paramMap = new HashMap<>();
paramMap.put(key, value);
return paramMap;
} | [
"public",
"static",
"Map",
"<",
"String",
",",
"Object",
">",
"keyValuePairAsMap",
"(",
"String",
"key",
",",
"Object",
"value",
")",
"{",
"Map",
"<",
"String",
",",
"Object",
">",
"paramMap",
"=",
"new",
"HashMap",
"<>",
"(",
")",
";",
"paramMap",
"."... | Convert key value pair to map
@param key Key
@param value Value
@return Map | [
"Convert",
"key",
"value",
"pair",
"to",
"map"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/suffix/impl/UrlSuffixUtil.java#L197-L201 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineAsset.java | InlineAsset.getInlineRendition | private Rendition getInlineRendition(MediaArgs mediaArgs) {
return new InlineRendition(this.resource, this.media, mediaArgs, this.fileName, this.adaptable);
} | java | private Rendition getInlineRendition(MediaArgs mediaArgs) {
return new InlineRendition(this.resource, this.media, mediaArgs, this.fileName, this.adaptable);
} | [
"private",
"Rendition",
"getInlineRendition",
"(",
"MediaArgs",
"mediaArgs",
")",
"{",
"return",
"new",
"InlineRendition",
"(",
"this",
".",
"resource",
",",
"this",
".",
"media",
",",
"mediaArgs",
",",
"this",
".",
"fileName",
",",
"this",
".",
"adaptable",
... | Get inline rendition instance.
@param mediaArgs Media args
@return Inline rendition instance (may be invalid rendition) | [
"Get",
"inline",
"rendition",
"instance",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineAsset.java#L140-L142 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.addRendition | private void addRendition(Set<RenditionMetadata> candidates, Rendition rendition, MediaArgs mediaArgs) {
// ignore AEM-generated thumbnail renditions unless allowed via mediaargs
if (!mediaArgs.isIncludeAssetThumbnails() && AssetRendition.isThumbnailRendition(rendition)) {
return;
}
// ignore AEM-... | java | private void addRendition(Set<RenditionMetadata> candidates, Rendition rendition, MediaArgs mediaArgs) {
// ignore AEM-generated thumbnail renditions unless allowed via mediaargs
if (!mediaArgs.isIncludeAssetThumbnails() && AssetRendition.isThumbnailRendition(rendition)) {
return;
}
// ignore AEM-... | [
"private",
"void",
"addRendition",
"(",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
",",
"Rendition",
"rendition",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"// ignore AEM-generated thumbnail renditions unless allowed via mediaargs",
"if",
"(",
"!",
"mediaArgs",
".... | adds rendition to the list of candidates, if it should be available for resolving
@param candidates
@param rendition | [
"adds",
"rendition",
"to",
"the",
"list",
"of",
"candidates",
"if",
"it",
"should",
"be",
"available",
"for",
"resolving"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L94-L108 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getRendtionsMatchingFileExtensions | private Set<RenditionMetadata> getRendtionsMatchingFileExtensions(String[] fileExtensions, MediaArgs mediaArgs) {
// if no file extension restriction get all renditions
Set<RenditionMetadata> allRenditions = getAvailableRenditions(mediaArgs);
if (fileExtensions == null || fileExtensions.length == 0) {
... | java | private Set<RenditionMetadata> getRendtionsMatchingFileExtensions(String[] fileExtensions, MediaArgs mediaArgs) {
// if no file extension restriction get all renditions
Set<RenditionMetadata> allRenditions = getAvailableRenditions(mediaArgs);
if (fileExtensions == null || fileExtensions.length == 0) {
... | [
"private",
"Set",
"<",
"RenditionMetadata",
">",
"getRendtionsMatchingFileExtensions",
"(",
"String",
"[",
"]",
"fileExtensions",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"// if no file extension restriction get all renditions",
"Set",
"<",
"RenditionMetadata",
">",
"allRen... | Get all renditions that match the requested list of file extension.
@param fileExtensions List of file extensions
@return Matching renditions | [
"Get",
"all",
"renditions",
"that",
"match",
"the",
"requested",
"list",
"of",
"file",
"extension",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L124-L143 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getRequestedFileExtensions | private String[] getRequestedFileExtensions(MediaArgs mediaArgs) {
// get file extension defined in media args
Set<String> mediaArgsFileExtensions = new HashSet<String>();
if (mediaArgs.getFileExtensions() != null && mediaArgs.getFileExtensions().length > 0) {
mediaArgsFileExtensions.addAll(ImmutableL... | java | private String[] getRequestedFileExtensions(MediaArgs mediaArgs) {
// get file extension defined in media args
Set<String> mediaArgsFileExtensions = new HashSet<String>();
if (mediaArgs.getFileExtensions() != null && mediaArgs.getFileExtensions().length > 0) {
mediaArgsFileExtensions.addAll(ImmutableL... | [
"private",
"String",
"[",
"]",
"getRequestedFileExtensions",
"(",
"MediaArgs",
"mediaArgs",
")",
"{",
"// get file extension defined in media args",
"Set",
"<",
"String",
">",
"mediaArgsFileExtensions",
"=",
"new",
"HashSet",
"<",
"String",
">",
"(",
")",
";",
"if",... | Get merged list of file extensions from both media formats and media args.
@param mediaArgs Media args
@return Array of file extensions.
Returns empty array if all file extensions are allowed.
Returns null if different file extensions are requested in media formats and media args
and the file extension filtering is not... | [
"Get",
"merged",
"list",
"of",
"file",
"extensions",
"from",
"both",
"media",
"formats",
"and",
"media",
"args",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L197-L236 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getExactMatchRendition | private RenditionMetadata getExactMatchRendition(final Set<RenditionMetadata> candidates, MediaArgs mediaArgs) {
// check for fixed width and/or height request
if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matc... | java | private RenditionMetadata getExactMatchRendition(final Set<RenditionMetadata> candidates, MediaArgs mediaArgs) {
// check for fixed width and/or height request
if (mediaArgs.getFixedWidth() > 0 || mediaArgs.getFixedHeight() > 0) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matc... | [
"private",
"RenditionMetadata",
"getExactMatchRendition",
"(",
"final",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"// check for fixed width and/or height request",
"if",
"(",
"mediaArgs",
".",
"getFixedWidth",
"(",
")",
... | Get rendition that matches exactly with the given media args requirements.
@param candidates Rendition candidates
@param mediaArgs Media args
@return Rendition or null if none found | [
"Get",
"rendition",
"that",
"matches",
"exactly",
"with",
"the",
"given",
"media",
"args",
"requirements",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L284-L321 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.getOriginalOrFirstRendition | private RenditionMetadata getOriginalOrFirstRendition(Set<RenditionMetadata> candidates) {
if (this.originalRendition != null && candidates.contains(this.originalRendition)) {
return this.originalRendition;
}
else if (!candidates.isEmpty()) {
return candidates.iterator().next();
}
else {... | java | private RenditionMetadata getOriginalOrFirstRendition(Set<RenditionMetadata> candidates) {
if (this.originalRendition != null && candidates.contains(this.originalRendition)) {
return this.originalRendition;
}
else if (!candidates.isEmpty()) {
return candidates.iterator().next();
}
else {... | [
"private",
"RenditionMetadata",
"getOriginalOrFirstRendition",
"(",
"Set",
"<",
"RenditionMetadata",
">",
"candidates",
")",
"{",
"if",
"(",
"this",
".",
"originalRendition",
"!=",
"null",
"&&",
"candidates",
".",
"contains",
"(",
"this",
".",
"originalRendition",
... | Returns original rendition - if it is contained in the candidate set. Otherwise first candidate is returned.
If a VirtualCropRenditionMetadata is present always the first one is returned.
@param candidates Candidates
@return Original or first rendition of candidates or null | [
"Returns",
"original",
"rendition",
"-",
"if",
"it",
"is",
"contained",
"in",
"the",
"candidate",
"set",
".",
"Otherwise",
"first",
"candidate",
"is",
"returned",
".",
"If",
"a",
"VirtualCropRenditionMetadata",
"is",
"present",
"always",
"the",
"first",
"one",
... | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L329-L339 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java | DefaultRenditionHandler.visitMediaFormats | @SuppressWarnings("null")
private <T> T visitMediaFormats(MediaArgs mediaArgs, MediaFormatVisitor<T> mediaFormatVisitor) {
MediaFormat[] mediaFormats = mediaArgs.getMediaFormats();
if (mediaFormats != null) {
for (MediaFormat mediaFormat : mediaFormats) {
T returnValue = mediaFormatVisitor.visit... | java | @SuppressWarnings("null")
private <T> T visitMediaFormats(MediaArgs mediaArgs, MediaFormatVisitor<T> mediaFormatVisitor) {
MediaFormat[] mediaFormats = mediaArgs.getMediaFormats();
if (mediaFormats != null) {
for (MediaFormat mediaFormat : mediaFormats) {
T returnValue = mediaFormatVisitor.visit... | [
"@",
"SuppressWarnings",
"(",
"\"null\"",
")",
"private",
"<",
"T",
">",
"T",
"visitMediaFormats",
"(",
"MediaArgs",
"mediaArgs",
",",
"MediaFormatVisitor",
"<",
"T",
">",
"mediaFormatVisitor",
")",
"{",
"MediaFormat",
"[",
"]",
"mediaFormats",
"=",
"mediaArgs",... | Iterate over all media formats defined in media args. Ignores invalid media formats.
If the media format visitor returns a value that is not null, iteration is stopped and the value is returned from
this method.
@param mediaArgs Media args
@param mediaFormatVisitor Media format visitor
@return Return value form media f... | [
"Iterate",
"over",
"all",
"media",
"formats",
"defined",
"in",
"media",
"args",
".",
"Ignores",
"invalid",
"media",
"formats",
".",
"If",
"the",
"media",
"format",
"visitor",
"returns",
"a",
"value",
"that",
"is",
"not",
"null",
"iteration",
"is",
"stopped",... | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DefaultRenditionHandler.java#L464-L476 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/spi/MediaSource.java | MediaSource.resolveFirstMatchRenditions | private boolean resolveFirstMatchRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
Rendition rendition = asset.getRendition(mediaArgs);
if (rendition != null) {
media.setRenditions(ImmutableList.of(rendition));
media.setUrl(rendition.getUrl());
return true;
}
return false;
... | java | private boolean resolveFirstMatchRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
Rendition rendition = asset.getRendition(mediaArgs);
if (rendition != null) {
media.setRenditions(ImmutableList.of(rendition));
media.setUrl(rendition.getUrl());
return true;
}
return false;
... | [
"private",
"boolean",
"resolveFirstMatchRenditions",
"(",
"Media",
"media",
",",
"Asset",
"asset",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"Rendition",
"rendition",
"=",
"asset",
".",
"getRendition",
"(",
"mediaArgs",
")",
";",
"if",
"(",
"rendition",
"!=",
"... | Check if a matching rendition is found for any of the provided media formats and other media args.
The first match is returned.
@param media Media
@param asset Asset
@param mediaArgs Media args
@return true if a rendition was found | [
"Check",
"if",
"a",
"matching",
"rendition",
"is",
"found",
"for",
"any",
"of",
"the",
"provided",
"media",
"formats",
"and",
"other",
"media",
"args",
".",
"The",
"first",
"match",
"is",
"returned",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L319-L327 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/spi/MediaSource.java | MediaSource.resolveAllRenditions | private boolean resolveAllRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
boolean allMandatory = mediaArgs.isMediaFormatsMandatory();
boolean allResolved = true;
boolean anyResolved = false;
List<Rendition> resolvedRenditions = new ArrayList<>();
for (MediaFormat mediaFormat : mediaArgs.... | java | private boolean resolveAllRenditions(Media media, Asset asset, MediaArgs mediaArgs) {
boolean allMandatory = mediaArgs.isMediaFormatsMandatory();
boolean allResolved = true;
boolean anyResolved = false;
List<Rendition> resolvedRenditions = new ArrayList<>();
for (MediaFormat mediaFormat : mediaArgs.... | [
"private",
"boolean",
"resolveAllRenditions",
"(",
"Media",
"media",
",",
"Asset",
"asset",
",",
"MediaArgs",
"mediaArgs",
")",
"{",
"boolean",
"allMandatory",
"=",
"mediaArgs",
".",
"isMediaFormatsMandatory",
"(",
")",
";",
"boolean",
"allResolved",
"=",
"true",
... | Iterates over all defined media format and tries to find a matching rendition for each of them
in combination with the other media args.
@param media Media
@param asset Asset
@param mediaArgs Media args
@return true if for all mandatory or for at least one media formats a rendition could be found. | [
"Iterates",
"over",
"all",
"defined",
"media",
"format",
"and",
"tries",
"to",
"find",
"a",
"matching",
"rendition",
"for",
"each",
"of",
"them",
"in",
"combination",
"with",
"the",
"other",
"media",
"args",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/spi/MediaSource.java#L337-L365 | train |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/ui/SiteRoot.java | SiteRoot.getRelativePage | public Page getRelativePage(String relativePath) {
String path = getRootPath();
if (path == null) {
return null;
}
StringBuilder sb = new StringBuilder(path);
if (!relativePath.startsWith("/")) {
sb.append("/");
}
sb.append(relativePath);
return pageManager.getPage(sb.toStrin... | java | public Page getRelativePage(String relativePath) {
String path = getRootPath();
if (path == null) {
return null;
}
StringBuilder sb = new StringBuilder(path);
if (!relativePath.startsWith("/")) {
sb.append("/");
}
sb.append(relativePath);
return pageManager.getPage(sb.toStrin... | [
"public",
"Page",
"getRelativePage",
"(",
"String",
"relativePath",
")",
"{",
"String",
"path",
"=",
"getRootPath",
"(",
")",
";",
"if",
"(",
"path",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"StringBuilder",
"sb",
"=",
"new",
"StringBuilder",
... | Get page relative to site root.
@param relativePath Path relative to site root
@return Page instance or null if not found | [
"Get",
"page",
"relative",
"to",
"site",
"root",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/ui/SiteRoot.java#L102-L113 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java | AbstractMediaFileServlet.isNotModified | protected boolean isNotModified(Resource resource, SlingHttpServletRequest request,
SlingHttpServletResponse response) throws IOException {
// check resource's modification date against the If-Modified-Since header and send 304 if resource wasn't modified
// never send expires header on author or publish ... | java | protected boolean isNotModified(Resource resource, SlingHttpServletRequest request,
SlingHttpServletResponse response) throws IOException {
// check resource's modification date against the If-Modified-Since header and send 304 if resource wasn't modified
// never send expires header on author or publish ... | [
"protected",
"boolean",
"isNotModified",
"(",
"Resource",
"resource",
",",
"SlingHttpServletRequest",
"request",
",",
"SlingHttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"// check resource's modification date against the If-Modified-Since header and send 304 if... | Checks if the resource was modified since last request
@param resource Resource pointing to nt:file or nt:resource node
@param request Request
@param response Response
@return true if the resource is not modified and should not be delivered anew
@throws IOException | [
"Checks",
"if",
"the",
"resource",
"was",
"modified",
"since",
"last",
"request"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java#L102-L108 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java | AbstractMediaFileServlet.sendBinaryData | protected void sendBinaryData(byte[] binaryData, String contentType,
SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
// set content type and length
response.setContentType(contentType);
response.setContentLength(binaryData.length);
// Handling of the "for... | java | protected void sendBinaryData(byte[] binaryData, String contentType,
SlingHttpServletRequest request, SlingHttpServletResponse response) throws IOException {
// set content type and length
response.setContentType(contentType);
response.setContentLength(binaryData.length);
// Handling of the "for... | [
"protected",
"void",
"sendBinaryData",
"(",
"byte",
"[",
"]",
"binaryData",
",",
"String",
"contentType",
",",
"SlingHttpServletRequest",
"request",
",",
"SlingHttpServletResponse",
"response",
")",
"throws",
"IOException",
"{",
"// set content type and length",
"response... | Send binary data to output stream. Respect optional content disposition header handling.
@param binaryData Binary data array.
@param contentType Content type
@param request Request
@param response Response
@throws IOException | [
"Send",
"binary",
"data",
"to",
"output",
"stream",
".",
"Respect",
"optional",
"content",
"disposition",
"header",
"handling",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/AbstractMediaFileServlet.java#L150-L178 | train |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java | AbstractUrlMode.getUrlConfigForTarget | protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Page targetPage) {
Resource targetResource = null;
if (targetPage != null) {
targetResource = targetPage.adaptTo(Resource.class);
}
return getUrlConfigForTarget(adaptable, targetResource);
} | java | protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Page targetPage) {
Resource targetResource = null;
if (targetPage != null) {
targetResource = targetPage.adaptTo(Resource.class);
}
return getUrlConfigForTarget(adaptable, targetResource);
} | [
"protected",
"UrlConfig",
"getUrlConfigForTarget",
"(",
"Adaptable",
"adaptable",
",",
"Page",
"targetPage",
")",
"{",
"Resource",
"targetResource",
"=",
"null",
";",
"if",
"(",
"targetPage",
"!=",
"null",
")",
"{",
"targetResource",
"=",
"targetPage",
".",
"ada... | Get URL configuration for target page. If this is invalid or not available, get it from adaptable.
@param adaptable Adaptable (request or resource)
@param targetPage Target page (may be null)
@return Url config (never null) | [
"Get",
"URL",
"configuration",
"for",
"target",
"page",
".",
"If",
"this",
"is",
"invalid",
"or",
"not",
"available",
"get",
"it",
"from",
"adaptable",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java#L55-L61 | train |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java | AbstractUrlMode.getUrlConfigForTarget | protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Resource targetResource) {
UrlConfig config = null;
if (targetResource != null) {
config = new UrlConfig(targetResource);
}
if (config == null || !config.isValid()) {
config = new UrlConfig(adaptable);
}
return config;
... | java | protected UrlConfig getUrlConfigForTarget(Adaptable adaptable, Resource targetResource) {
UrlConfig config = null;
if (targetResource != null) {
config = new UrlConfig(targetResource);
}
if (config == null || !config.isValid()) {
config = new UrlConfig(adaptable);
}
return config;
... | [
"protected",
"UrlConfig",
"getUrlConfigForTarget",
"(",
"Adaptable",
"adaptable",
",",
"Resource",
"targetResource",
")",
"{",
"UrlConfig",
"config",
"=",
"null",
";",
"if",
"(",
"targetResource",
"!=",
"null",
")",
"{",
"config",
"=",
"new",
"UrlConfig",
"(",
... | Get URL configuration for target resource. If this is invalid or not available, get it from adaptable.
@param adaptable Adaptable (request or resource)
@param targetResource Target resource (may be null)
@return Url config (never null) | [
"Get",
"URL",
"configuration",
"for",
"target",
"resource",
".",
"If",
"this",
"is",
"invalid",
"or",
"not",
"available",
"get",
"it",
"from",
"adaptable",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/modes/AbstractUrlMode.java#L69-L78 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/format/MediaFormatBuilder.java | MediaFormatBuilder.build | public @NotNull MediaFormat build() {
if (this.name == null) {
throw new IllegalArgumentException("Name is missing.");
}
return new MediaFormat(
name,
label,
description,
width,
minWidth,
maxWidth,
height,
minHeight,
maxHeight,
... | java | public @NotNull MediaFormat build() {
if (this.name == null) {
throw new IllegalArgumentException("Name is missing.");
}
return new MediaFormat(
name,
label,
description,
width,
minWidth,
maxWidth,
height,
minHeight,
maxHeight,
... | [
"public",
"@",
"NotNull",
"MediaFormat",
"build",
"(",
")",
"{",
"if",
"(",
"this",
".",
"name",
"==",
"null",
")",
"{",
"throw",
"new",
"IllegalArgumentException",
"(",
"\"Name is missing.\"",
")",
";",
"}",
"return",
"new",
"MediaFormat",
"(",
"name",
",... | Builds the media format definition.
@return Media format definition | [
"Builds",
"the",
"media",
"format",
"definition",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/format/MediaFormatBuilder.java#L300-L324 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/impl/DamAsset.java | DamAsset.getDamRendition | protected Rendition getDamRendition(MediaArgs mediaArgs) {
return new DamRendition(this.damAsset, this.cropDimension, this.rotation, mediaArgs, adaptable);
} | java | protected Rendition getDamRendition(MediaArgs mediaArgs) {
return new DamRendition(this.damAsset, this.cropDimension, this.rotation, mediaArgs, adaptable);
} | [
"protected",
"Rendition",
"getDamRendition",
"(",
"MediaArgs",
"mediaArgs",
")",
"{",
"return",
"new",
"DamRendition",
"(",
"this",
".",
"damAsset",
",",
"this",
".",
"cropDimension",
",",
"this",
".",
"rotation",
",",
"mediaArgs",
",",
"adaptable",
")",
";",
... | Get DAM rendition instance.
@param mediaArgs Media args
@return DAM rendition instance (may be invalid rendition) | [
"Get",
"DAM",
"rendition",
"instance",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/impl/DamAsset.java#L161-L163 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java | ResponsiveImageMediaMarkupBuilder.getImageElement | protected HtmlElement<?> getImageElement(Media media) {
Image img = new Image();
// Alternative text
Asset asset = media.getAsset();
String altText = null;
if (asset != null) {
altText = asset.getAltText();
}
if (StringUtils.isNotEmpty(altText)) {
img.setAlt(altText);
}
... | java | protected HtmlElement<?> getImageElement(Media media) {
Image img = new Image();
// Alternative text
Asset asset = media.getAsset();
String altText = null;
if (asset != null) {
altText = asset.getAltText();
}
if (StringUtils.isNotEmpty(altText)) {
img.setAlt(altText);
}
... | [
"protected",
"HtmlElement",
"<",
"?",
">",
"getImageElement",
"(",
"Media",
"media",
")",
"{",
"Image",
"img",
"=",
"new",
"Image",
"(",
")",
";",
"// Alternative text",
"Asset",
"asset",
"=",
"media",
".",
"getAsset",
"(",
")",
";",
"String",
"altText",
... | Create an IMG element with alt text.
@param media Media metadata
@return IMG element with properties | [
"Create",
"an",
"IMG",
"element",
"with",
"alt",
"text",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java#L95-L109 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java | ResponsiveImageMediaMarkupBuilder.setResponsiveImageSource | protected void setResponsiveImageSource(HtmlElement<?> mediaElement, JSONArray responsiveImageSources, Media media) {
mediaElement.setData(PROP_RESPONSIVE_SOURCES, responsiveImageSources.toString());
} | java | protected void setResponsiveImageSource(HtmlElement<?> mediaElement, JSONArray responsiveImageSources, Media media) {
mediaElement.setData(PROP_RESPONSIVE_SOURCES, responsiveImageSources.toString());
} | [
"protected",
"void",
"setResponsiveImageSource",
"(",
"HtmlElement",
"<",
"?",
">",
"mediaElement",
",",
"JSONArray",
"responsiveImageSources",
",",
"Media",
"media",
")",
"{",
"mediaElement",
".",
"setData",
"(",
"PROP_RESPONSIVE_SOURCES",
",",
"responsiveImageSources"... | Set attribute on media element for responsive image sources
@param mediaElement Media element
@param responsiveImageSources Responsive image sources JSON metadata
@param media Media | [
"Set",
"attribute",
"on",
"media",
"element",
"for",
"responsive",
"image",
"sources"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/ResponsiveImageMediaMarkupBuilder.java#L151-L153 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/markup/DummyResponsiveImageMediaMarkupBuilder.java | DummyResponsiveImageMediaMarkupBuilder.getImageElement | protected HtmlElement<?> getImageElement(Media media) {
Image img = new Image().addCssClass(MediaNameConstants.CSS_DUMMYIMAGE);
return img;
} | java | protected HtmlElement<?> getImageElement(Media media) {
Image img = new Image().addCssClass(MediaNameConstants.CSS_DUMMYIMAGE);
return img;
} | [
"protected",
"HtmlElement",
"<",
"?",
">",
"getImageElement",
"(",
"Media",
"media",
")",
"{",
"Image",
"img",
"=",
"new",
"Image",
"(",
")",
".",
"addCssClass",
"(",
"MediaNameConstants",
".",
"CSS_DUMMYIMAGE",
")",
";",
"return",
"img",
";",
"}"
] | Create an IMG element.
@param media Media metadata
@return IMG element with properties | [
"Create",
"an",
"IMG",
"element",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/markup/DummyResponsiveImageMediaMarkupBuilder.java#L111-L114 | train |
wcm-io/wcm-io-handler | commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java | AbstractHtmlElementFactory.createComment | public HtmlComment createComment(String text) {
HtmlComment comment = new HtmlComment(text);
this.addContent(comment);
return comment;
} | java | public HtmlComment createComment(String text) {
HtmlComment comment = new HtmlComment(text);
this.addContent(comment);
return comment;
} | [
"public",
"HtmlComment",
"createComment",
"(",
"String",
"text",
")",
"{",
"HtmlComment",
"comment",
"=",
"new",
"HtmlComment",
"(",
"text",
")",
";",
"this",
".",
"addContent",
"(",
"comment",
")",
";",
"return",
"comment",
";",
"}"
] | Creates and adds html comment.
@param text Comment
@return Html comment. | [
"Creates",
"and",
"adds",
"html",
"comment",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/commons/src/main/java/io/wcm/handler/commons/dom/AbstractHtmlElementFactory.java#L56-L60 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/media/impl/JcrBinary.java | JcrBinary.isNt | private static boolean isNt(Resource resource, String nodeTypeName) {
if (resource != null) {
return StringUtils.equals(resource.getResourceType(), nodeTypeName);
}
return false;
} | java | private static boolean isNt(Resource resource, String nodeTypeName) {
if (resource != null) {
return StringUtils.equals(resource.getResourceType(), nodeTypeName);
}
return false;
} | [
"private",
"static",
"boolean",
"isNt",
"(",
"Resource",
"resource",
",",
"String",
"nodeTypeName",
")",
"{",
"if",
"(",
"resource",
"!=",
"null",
")",
"{",
"return",
"StringUtils",
".",
"equals",
"(",
"resource",
".",
"getResourceType",
"(",
")",
",",
"no... | Checks if the given resource is a node with the given node type name
@param resource Resource
@param nodeTypeName Node type name
@return true if resource is of the given node type | [
"Checks",
"if",
"the",
"given",
"resource",
"is",
"a",
"node",
"with",
"the",
"given",
"node",
"type",
"name"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/media/impl/JcrBinary.java#L86-L91 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.getVideoProfiles | protected List<VideoProfile> getVideoProfiles() {
List<VideoProfile> profiles = new ArrayList<VideoProfile>();
for (String profileName : getVideoProfileNames()) {
VideoProfile profile = VideoProfile.get(resourceResolver, profileName);
if (profile != null) {
profiles.add(profile);
}
... | java | protected List<VideoProfile> getVideoProfiles() {
List<VideoProfile> profiles = new ArrayList<VideoProfile>();
for (String profileName : getVideoProfileNames()) {
VideoProfile profile = VideoProfile.get(resourceResolver, profileName);
if (profile != null) {
profiles.add(profile);
}
... | [
"protected",
"List",
"<",
"VideoProfile",
">",
"getVideoProfiles",
"(",
")",
"{",
"List",
"<",
"VideoProfile",
">",
"profiles",
"=",
"new",
"ArrayList",
"<",
"VideoProfile",
">",
"(",
")",
";",
"for",
"(",
"String",
"profileName",
":",
"getVideoProfileNames",
... | Return video profiles supported by this markup builder.
@return Video profiles | [
"Return",
"video",
"profiles",
"supported",
"by",
"this",
"markup",
"builder",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L105-L117 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.addSources | protected void addSources(Video video, Media media) {
Asset asset = getDamAsset(media);
if (asset == null) {
return;
}
for (VideoProfile profile : getVideoProfiles()) {
com.day.cq.dam.api.Rendition rendition = profile.getRendition(asset);
if (rendition != null) {
video.createS... | java | protected void addSources(Video video, Media media) {
Asset asset = getDamAsset(media);
if (asset == null) {
return;
}
for (VideoProfile profile : getVideoProfiles()) {
com.day.cq.dam.api.Rendition rendition = profile.getRendition(asset);
if (rendition != null) {
video.createS... | [
"protected",
"void",
"addSources",
"(",
"Video",
"video",
",",
"Media",
"media",
")",
"{",
"Asset",
"asset",
"=",
"getDamAsset",
"(",
"media",
")",
";",
"if",
"(",
"asset",
"==",
"null",
")",
"{",
"return",
";",
"}",
"for",
"(",
"VideoProfile",
"profil... | Add sources for HTML5 video player
@param video Video
@param media Media metadata | [
"Add",
"sources",
"for",
"HTML5",
"video",
"player"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L159-L173 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.getFlashPlayerElement | protected HtmlElement getFlashPlayerElement(Media media, Dimension dimension) {
Asset asset = getDamAsset(media);
if (asset == null) {
return null;
}
com.day.cq.dam.api.Rendition rendition = asset.getRendition(new PrefixRenditionPicker(VideoConstants.RENDITION_PREFIX + H264_PROFILE));
if (ren... | java | protected HtmlElement getFlashPlayerElement(Media media, Dimension dimension) {
Asset asset = getDamAsset(media);
if (asset == null) {
return null;
}
com.day.cq.dam.api.Rendition rendition = asset.getRendition(new PrefixRenditionPicker(VideoConstants.RENDITION_PREFIX + H264_PROFILE));
if (ren... | [
"protected",
"HtmlElement",
"getFlashPlayerElement",
"(",
"Media",
"media",
",",
"Dimension",
"dimension",
")",
"{",
"Asset",
"asset",
"=",
"getDamAsset",
"(",
"media",
")",
";",
"if",
"(",
"asset",
"==",
"null",
")",
"{",
"return",
"null",
";",
"}",
"com"... | Build flash player element
@param media Media metadata
@param dimension Dimension
@return Media element | [
"Build",
"flash",
"player",
"element"
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L181-L226 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.buildFlashVarsString | protected String buildFlashVarsString(Map<String, String> flashVars) {
try {
StringBuilder flashvarsString = new StringBuilder();
Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator();
while (flashvarsIterator.hasNext()) {
Map.Entry<String, String> entry =... | java | protected String buildFlashVarsString(Map<String, String> flashVars) {
try {
StringBuilder flashvarsString = new StringBuilder();
Iterator<Map.Entry<String, String>> flashvarsIterator = flashVars.entrySet().iterator();
while (flashvarsIterator.hasNext()) {
Map.Entry<String, String> entry =... | [
"protected",
"String",
"buildFlashVarsString",
"(",
"Map",
"<",
"String",
",",
"String",
">",
"flashVars",
")",
"{",
"try",
"{",
"StringBuilder",
"flashvarsString",
"=",
"new",
"StringBuilder",
"(",
")",
";",
"Iterator",
"<",
"Map",
".",
"Entry",
"<",
"Strin... | Build flashvars string to be used on HTML object element for flash embedding.
@param flashVars flashvars map
@return flashvars string with proper encoding | [
"Build",
"flashvars",
"string",
"to",
"be",
"used",
"on",
"HTML",
"object",
"element",
"for",
"flash",
"embedding",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L233-L251 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.getAdditionalFlashPlayerParameters | protected Map<String, String> getAdditionalFlashPlayerParameters(Media media, Dimension dimension) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("allowFullScreen", "true");
parameters.put("wmode", "opaque");
return parameters;
} | java | protected Map<String, String> getAdditionalFlashPlayerParameters(Media media, Dimension dimension) {
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("allowFullScreen", "true");
parameters.put("wmode", "opaque");
return parameters;
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"getAdditionalFlashPlayerParameters",
"(",
"Media",
"media",
",",
"Dimension",
"dimension",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"parameters",
"=",
"new",
"HashMap",
"<",
"String",
",",
"S... | Get additional parameters to be set as <param> elements on html object element for flash player.
@param media Media metadata
@param dimension Dimension
@return Set of key/value pairs | [
"Get",
"additional",
"parameters",
"to",
"be",
"set",
"as",
"<",
";",
"param>",
";",
"elements",
"on",
"html",
"object",
"element",
"for",
"flash",
"player",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L259-L266 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java | DamVideoMediaMarkupBuilder.getAdditionalFlashPlayerFlashVars | protected Map<String, String> getAdditionalFlashPlayerFlashVars(Media media, Dimension dimension) {
Map<String, String> flashvars = new HashMap<String, String>();
flashvars.put("autoPlay", "false");
flashvars.put("loop", "false");
return flashvars;
} | java | protected Map<String, String> getAdditionalFlashPlayerFlashVars(Media media, Dimension dimension) {
Map<String, String> flashvars = new HashMap<String, String>();
flashvars.put("autoPlay", "false");
flashvars.put("loop", "false");
return flashvars;
} | [
"protected",
"Map",
"<",
"String",
",",
"String",
">",
"getAdditionalFlashPlayerFlashVars",
"(",
"Media",
"media",
",",
"Dimension",
"dimension",
")",
"{",
"Map",
"<",
"String",
",",
"String",
">",
"flashvars",
"=",
"new",
"HashMap",
"<",
"String",
",",
"Str... | Get additional parameters to be set as flashvars parameter on html object element for flash player.
@param media Media metadata
@param dimension Dimension
@return Set of key/value pairs | [
"Get",
"additional",
"parameters",
"to",
"be",
"set",
"as",
"flashvars",
"parameter",
"on",
"html",
"object",
"element",
"for",
"flash",
"player",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/dam/markup/DamVideoMediaMarkupBuilder.java#L274-L281 | train |
wcm-io/wcm-io-handler | url/src/main/java/io/wcm/handler/url/impl/modes/DefaultUrlMode.java | DefaultUrlMode.linksToOtherDomain | private boolean linksToOtherDomain(Adaptable adaptable, Page currentPage, Resource targetResource) {
if (currentPage == null || targetResource == null) {
return false;
}
UrlHandlerConfig urlHandlerConfig = AdaptTo.notNull(adaptable, UrlHandlerConfig.class);
Resource currentResource = AdaptTo.notN... | java | private boolean linksToOtherDomain(Adaptable adaptable, Page currentPage, Resource targetResource) {
if (currentPage == null || targetResource == null) {
return false;
}
UrlHandlerConfig urlHandlerConfig = AdaptTo.notNull(adaptable, UrlHandlerConfig.class);
Resource currentResource = AdaptTo.notN... | [
"private",
"boolean",
"linksToOtherDomain",
"(",
"Adaptable",
"adaptable",
",",
"Page",
"currentPage",
",",
"Resource",
"targetResource",
")",
"{",
"if",
"(",
"currentPage",
"==",
"null",
"||",
"targetResource",
"==",
"null",
")",
"{",
"return",
"false",
";",
... | Checks if the target resource is located outsite the current site, and if for this other
resource context a valid url configuration with a specific hostname exists.
@param adaptable Adaptable
@param currentPage Current page (may be null)
@param targetResource Target resource (may be null)
@return true if the target res... | [
"Checks",
"if",
"the",
"target",
"resource",
"is",
"located",
"outsite",
"the",
"current",
"site",
"and",
"if",
"for",
"this",
"other",
"resource",
"context",
"a",
"valid",
"url",
"configuration",
"with",
"a",
"specific",
"hostname",
"exists",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/url/src/main/java/io/wcm/handler/url/impl/modes/DefaultUrlMode.java#L79-L98 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.getScaledDimension | private Dimension getScaledDimension(Dimension originalDimension) {
// check if image has to be rescaled
Dimension requestedDimension = getRequestedDimension();
boolean scaleWidth = (requestedDimension.getWidth() > 0
&& requestedDimension.getWidth() != originalDimension.getWidth());
boolean sca... | java | private Dimension getScaledDimension(Dimension originalDimension) {
// check if image has to be rescaled
Dimension requestedDimension = getRequestedDimension();
boolean scaleWidth = (requestedDimension.getWidth() > 0
&& requestedDimension.getWidth() != originalDimension.getWidth());
boolean sca... | [
"private",
"Dimension",
"getScaledDimension",
"(",
"Dimension",
"originalDimension",
")",
"{",
"// check if image has to be rescaled",
"Dimension",
"requestedDimension",
"=",
"getRequestedDimension",
"(",
")",
";",
"boolean",
"scaleWidth",
"=",
"(",
"requestedDimension",
".... | Checks if the current binary is an image and has to be scaled. In this case the destination dimension is returned.
@return Scaled destination or null if no scaling is required. If a destination object with both
width and height set to -1 is returned, a scaling is required but not possible with the given source
object. | [
"Checks",
"if",
"the",
"current",
"binary",
"is",
"an",
"image",
"and",
"has",
"to",
"be",
"scaled",
".",
"In",
"this",
"case",
"the",
"destination",
"dimension",
"is",
"returned",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L150-L187 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.buildMediaUrl | private String buildMediaUrl(Dimension scaledDimension) {
// check for file extension filtering
if (!isMatchingFileExtension()) {
return null;
}
// check if image has to be rescaled
if (scaledDimension != null) {
// check if scaling is not possible
if (scaledDimension.equals(SCA... | java | private String buildMediaUrl(Dimension scaledDimension) {
// check for file extension filtering
if (!isMatchingFileExtension()) {
return null;
}
// check if image has to be rescaled
if (scaledDimension != null) {
// check if scaling is not possible
if (scaledDimension.equals(SCA... | [
"private",
"String",
"buildMediaUrl",
"(",
"Dimension",
"scaledDimension",
")",
"{",
"// check for file extension filtering",
"if",
"(",
"!",
"isMatchingFileExtension",
"(",
")",
")",
"{",
"return",
"null",
";",
"}",
"// check if image has to be rescaled",
"if",
"(",
... | Build media URL for this rendition - either "native" URL to repository or virtual url to rescaled version.
@return Media URL - null if no rendition is available | [
"Build",
"media",
"URL",
"for",
"this",
"rendition",
"-",
"either",
"native",
"URL",
"to",
"repository",
"or",
"virtual",
"url",
"to",
"rescaled",
"version",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L193-L225 | train |
wcm-io/wcm-io-handler | media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java | InlineRendition.buildNativeMediaUrl | private String buildNativeMediaUrl() {
String path = null;
Resource parentResource = this.resource.getParent();
if (JcrBinary.isNtFile(parentResource)) {
// if parent resource is nt:file and its node name equals the detected filename, directly use the nt:file node path
if (StringUtils.equals(pa... | java | private String buildNativeMediaUrl() {
String path = null;
Resource parentResource = this.resource.getParent();
if (JcrBinary.isNtFile(parentResource)) {
// if parent resource is nt:file and its node name equals the detected filename, directly use the nt:file node path
if (StringUtils.equals(pa... | [
"private",
"String",
"buildNativeMediaUrl",
"(",
")",
"{",
"String",
"path",
"=",
"null",
";",
"Resource",
"parentResource",
"=",
"this",
".",
"resource",
".",
"getParent",
"(",
")",
";",
"if",
"(",
"JcrBinary",
".",
"isNtFile",
"(",
"parentResource",
")",
... | Builds "native" URL that returns the binary data directly from the repository.
@return Media URL | [
"Builds",
"native",
"URL",
"that",
"returns",
"the",
"binary",
"data",
"directly",
"from",
"the",
"repository",
"."
] | b0fc1c11a3ceb89efb73826dcfd480d6a00c19af | https://github.com/wcm-io/wcm-io-handler/blob/b0fc1c11a3ceb89efb73826dcfd480d6a00c19af/media/src/main/java/io/wcm/handler/mediasource/inline/InlineRendition.java#L231-L253 | train |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.