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 token.");
}
tokens.add(QueryOperatorToken.OR);
} | 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 token.");
}
tokens.add(QueryOperatorToken.OR);
} | [
"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);
indexQuery.setQueryParameters(queryParameters);
indexQuery.setDisableCaching(disableCaching);
if (pageSize != null) {
indexQuery.setPageSize(pageSize);
}
return indexQuery;
} | java | protected IndexQuery generateIndexQuery(String query) {
IndexQuery indexQuery = new IndexQuery();
indexQuery.setQuery(query);
indexQuery.setStart(start);
indexQuery.setWaitForNonStaleResults(theWaitForNonStaleResults);
indexQuery.setWaitForNonStaleResultsTimeout(timeout);
indexQuery.setQueryParameters(queryParameters);
indexQuery.setDisableCaching(disableCaching);
if (pageSize != null) {
indexQuery.setPageSize(pageSize);
}
return indexQuery;
} | [
"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.setIncludedPaths(getIncludedPaths());
queryResult.setStale(isStale());
queryResult.setSkippedResults(getSkippedResults());
queryResult.setTotalResults(getTotalResults());
queryResult.setHighlightings(getHighlightings() != null ? new HashMap<>(getHighlightings()) : null);
queryResult.setExplanations(getExplanations() != null ? new HashMap<>(getExplanations()) : null);
queryResult.setTimings(getTimings());
queryResult.setLastQueryTime(getLastQueryTime());
queryResult.setDurationInMs(getDurationInMs());
queryResult.setResultEtag(getResultEtag());
queryResult.setNodeTag(getNodeTag());
queryResult.setCounterIncludes(getCounterIncludes());
queryResult.setIncludedCounterNames(getIncludedCounterNames());
return queryResult;
} | java | public QueryResult createSnapshot() {
QueryResult queryResult = new QueryResult();
queryResult.setResults(getResults());
queryResult.setIncludes(getIncludes());
queryResult.setIndexName(getIndexName());
queryResult.setIndexTimestamp(getIndexTimestamp());
queryResult.setIncludedPaths(getIncludedPaths());
queryResult.setStale(isStale());
queryResult.setSkippedResults(getSkippedResults());
queryResult.setTotalResults(getTotalResults());
queryResult.setHighlightings(getHighlightings() != null ? new HashMap<>(getHighlightings()) : null);
queryResult.setExplanations(getExplanations() != null ? new HashMap<>(getExplanations()) : null);
queryResult.setTimings(getTimings());
queryResult.setLastQueryTime(getLastQueryTime());
queryResult.setDurationInMs(getDurationInMs());
queryResult.setResultEtag(getResultEtag());
queryResult.setNodeTag(getNodeTag());
queryResult.setCounterIncludes(getCounterIncludes());
queryResult.setIncludedCounterNames(getIncludedCounterNames());
return queryResult;
} | [
"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);
requestExecutor.execute(command);
return Arrays.asList(command.getResult());
} | 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);
requestExecutor.execute(command);
return Arrays.asList(command.getResult());
} | [
"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.firstNonNull(database, _store.getDatabase()));
GetSubscriptionStateCommand command = new GetSubscriptionStateCommand(subscriptionName);
requestExecutor.execute(command);
return command.getResult();
} | java | public SubscriptionState getSubscriptionState(String subscriptionName, String database) {
if (StringUtils.isEmpty(subscriptionName)) {
throw new IllegalArgumentException("SubscriptionName cannot be null");
}
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
GetSubscriptionStateCommand command = new GetSubscriptionStateCommand(subscriptionName);
requestExecutor.execute(command);
return command.getResult();
} | [
"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(command);
} | java | public void dropConnection(String name, String database) {
RequestExecutor requestExecutor = _store.getRequestExecutor(ObjectUtils.firstNonNull(database, _store.getDatabase()));
DropSubscriptionConnectionCommand command = new DropSubscriptionConnectionCommand(name);
requestExecutor.execute(command);
} | [
"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/multifield component)
contentPath = ((SlingHttpServletRequest)request).getRequestPathInfo().getSuffix();
}
return contentPath;
} | 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/multifield component)
contentPath = ((SlingHttpServletRequest)request).getRequestPathInfo().getSuffix();
}
return contentPath;
} | [
"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 IllegalStateException("Cannot execute saveChanges when entity tracking is disabled in session.");
}
_requestExecutor.execute(command, sessionInfo);
updateSessionAfterSaveChanges(command.getResult());
saveChangeOperation.setResult(command.getResult());
}
} | java | @Override
public void saveChanges() {
BatchOperation saveChangeOperation = new BatchOperation(this);
try (BatchCommand command = saveChangeOperation.createRequest()) {
if (command == null) {
return;
}
if (noTracking) {
throw new IllegalStateException("Cannot execute saveChanges when entity tracking is disabled in session.");
}
_requestExecutor.execute(command, sessionInfo);
updateSessionAfterSaveChanges(command.getResult());
saveChangeOperation.setResult(command.getResult());
}
} | [
"@",
"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;
}
HeadDocumentCommand command = new HeadDocumentCommand(id, null);
_requestExecutor.execute(command, sessionInfo);
return command.getResult() != null;
} | 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;
}
HeadDocumentCommand command = new HeadDocumentCommand(id, null);
_requestExecutor.execute(command, sessionInfo);
return command.getResult() != null;
} | [
"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 GetDocumentsCommand(new String[]{documentInfo.getId()}, null, false);
_requestExecutor.execute(command, sessionInfo);
refreshInternal(entity, command, documentInfo);
} | 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 GetDocumentsCommand(new String[]{documentInfo.getId()}, null, false);
_requestExecutor.execute(command, sessionInfo);
refreshInternal(entity, command, documentInfo);
} | [
"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(entityType);
Object entity = defaultValue;
String documentType =_session.getConventions().getJavaClass(id, document);
if (documentType != null) {
Class type = Class.forName(documentType);
if (entityType.isAssignableFrom(type)) {
entity = _session.getConventions().getEntityMapper().treeToValue(document, type);
}
}
if (entity == defaultValue) {
entity = _session.getConventions().getEntityMapper().treeToValue(document, entityType);
}
if (id != null) {
_session.getGenerateEntityIdOnTheClient().trySetIdentity(entity, id);
}
return entity;
} catch (Exception e) {
throw new IllegalStateException("Could not convert document " + id + " to entity of type " + entityType.getName(), e);
}
} | java | @SuppressWarnings("unchecked")
public Object convertToEntity(Class entityType, String id, ObjectNode document) {
try {
if (ObjectNode.class.equals(entityType)) {
return document;
}
Object defaultValue = InMemoryDocumentSessionOperations.getDefaultValue(entityType);
Object entity = defaultValue;
String documentType =_session.getConventions().getJavaClass(id, document);
if (documentType != null) {
Class type = Class.forName(documentType);
if (entityType.isAssignableFrom(type)) {
entity = _session.getConventions().getEntityMapper().treeToValue(document, type);
}
}
if (entity == defaultValue) {
entity = _session.getConventions().getEntityMapper().treeToValue(document, entityType);
}
if (id != null) {
_session.getGenerateEntityIdOnTheClient().trySetIdentity(entity, id);
}
return entity;
} catch (Exception e) {
throw new IllegalStateException("Could not convert document " + id + " to entity of type " + entityType.getName(), e);
}
} | [
"@",
"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 (pageObject != null) {
// write children
Iterator<Page> children = listChildren(page.adaptTo(Resource.class), pageFilter);
if (!children.hasNext()) {
pageObject.put("leaf", true);
}
else if (depth < getMaxDepth() - 1) {
pageObject.put("children", getPages(children, depth + 1, pageFilter));
}
pagesArray.put(pageObject);
}
}
return pagesArray;
} | 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 (pageObject != null) {
// write children
Iterator<Page> children = listChildren(page.adaptTo(Resource.class), pageFilter);
if (!children.hasNext()) {
pageObject.put("leaf", true);
}
else if (depth < getMaxDepth() - 1) {
pageObject.put("children", getPages(children, depth + 1, pageFilter));
}
pagesArray.put(pageObject);
}
}
return pagesArray;
} | [
"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();
if (StringUtils.isEmpty(title)) {
title = page.getName();
}
pageObject.put("text", title);
// resource type
pageObject.put("type", resource.getResourceType());
// template
String template = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
if (StringUtils.isNotEmpty(template)) {
pageObject.put("template", template);
}
// css class for icon
pageObject.put("cls", "page");
return pageObject;
} | 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();
if (StringUtils.isEmpty(title)) {
title = page.getName();
}
pageObject.put("text", title);
// resource type
pageObject.put("type", resource.getResourceType());
// template
String template = page.getProperties().get(NameConstants.PN_TEMPLATE, String.class);
if (StringUtils.isNotEmpty(template)) {
pageObject.put("template", template);
}
// css class for icon
pageObject.put("cls", "page");
return pageObject;
} | [
"@",
"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(",", urls);
} | 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(",", urls);
} | [
"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 generator = new MultiDatabaseHiLoIdGenerator(this, getConventions());
_multiDbHiLo = generator;
getConventions().setDocumentIdGenerator(generator::generateDocumentId);
}
getConventions().freeze();
initialized = true;
} catch (Exception e) {
close();
throw ExceptionsUtils.unwrapException(e);
}
return this;
} | java | @Override
public IDocumentStore initialize() {
if (initialized) {
return this;
}
assertValidConfiguration();
try {
if (getConventions().getDocumentIdGenerator() == null) { // don't overwrite what the user is doing
MultiDatabaseHiLoIdGenerator generator = new MultiDatabaseHiLoIdGenerator(this, getConventions());
_multiDbHiLo = generator;
getConventions().setDocumentIdGenerator(generator::generateDocumentId);
}
getConventions().freeze();
initialized = true;
} catch (Exception e) {
close();
throw ExceptionsUtils.unwrapException(e);
}
return this;
} | [
"@",
"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));
}
}
return false;
} | 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));
}
}
return false;
} | [
"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 indexDefinition = createIndexDefinition();
indexDefinition.setName(getIndexName());
if (lockMode != null) {
indexDefinition.setLockMode(lockMode);
}
if (priority != null) {
indexDefinition.setPriority(priority);
}
store.maintenance().forDatabase(ObjectUtils.firstNonNull(database, store.getDatabase())).send(new PutIndexesOperation(indexDefinition));
} finally {
setConventions(oldConventions);
}
} | java | public void execute(IDocumentStore store, DocumentConventions conventions, String database) {
DocumentConventions oldConventions = getConventions();
try {
setConventions(ObjectUtils.firstNonNull(conventions, getConventions(), store.getConventions()));
IndexDefinition indexDefinition = createIndexDefinition();
indexDefinition.setName(getIndexName());
if (lockMode != null) {
indexDefinition.setLockMode(lockMode);
}
if (priority != null) {
indexDefinition.setPriority(priority);
}
store.maintenance().forDatabase(ObjectUtils.firstNonNull(database, store.getDatabase())).send(new PutIndexesOperation(indexDefinition));
} finally {
setConventions(oldConventions);
}
} | [
"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 Declarative Services Spec: configuration policy). In this case, a component
gets only active if a configuration is available. Such a configuration can be put into the repository
for the specific run mode. | [
"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);
indexDefinitionBuilder.setAnalyzersStrings(analyzersStrings);
indexDefinitionBuilder.setMap(map);
indexDefinitionBuilder.setReduce(reduce);
indexDefinitionBuilder.setStoresStrings(storesStrings);
indexDefinitionBuilder.setSuggestionsOptions(indexSuggestions);
indexDefinitionBuilder.setTermVectorsStrings(termVectorsStrings);
indexDefinitionBuilder.setSpatialIndexesStrings(spatialOptionsStrings);
indexDefinitionBuilder.setOutputReduceToCollection(outputReduceToCollection);
indexDefinitionBuilder.setAdditionalSources(getAdditionalSources());
return indexDefinitionBuilder.toIndexDefinition(conventions);
} | java | public IndexDefinition createIndexDefinition() {
if (conventions == null) {
conventions = new DocumentConventions();
}
IndexDefinitionBuilder indexDefinitionBuilder = new IndexDefinitionBuilder(getIndexName());
indexDefinitionBuilder.setIndexesStrings(indexesStrings);
indexDefinitionBuilder.setAnalyzersStrings(analyzersStrings);
indexDefinitionBuilder.setMap(map);
indexDefinitionBuilder.setReduce(reduce);
indexDefinitionBuilder.setStoresStrings(storesStrings);
indexDefinitionBuilder.setSuggestionsOptions(indexSuggestions);
indexDefinitionBuilder.setTermVectorsStrings(termVectorsStrings);
indexDefinitionBuilder.setSpatialIndexesStrings(spatialOptionsStrings);
indexDefinitionBuilder.setOutputReduceToCollection(outputReduceToCollection);
indexDefinitionBuilder.setAdditionalSources(getAdditionalSources());
return indexDefinitionBuilder.toIndexDefinition(conventions);
} | [
"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 == null) {
throw new RuntimeException("PredicateProvider service not available.");
}
Predicate predicate = predicateProvider.getPredicate(predicateName);
if (predicate == null) {
throw new RuntimeException("Predicate '" + predicateName + "' not available.");
}
return new PredicatePageFilter(predicate, true, true);
}
return null;
} | 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 == null) {
throw new RuntimeException("PredicateProvider service not available.");
}
Predicate predicate = predicateProvider.getPredicate(predicateName);
if (predicate == null) {
throw new RuntimeException("Predicate '" + predicateName + "' not available.");
}
return new PredicatePageFilter(predicate, true, true);
}
return null;
} | [
"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 indexedAnnotation = annotatedMethod.getByMetaAnnotation(IndexDefinition.class);
if (indexedAnnotation != null) {
if (!(methodMetadata instanceof PrimitivePropertyMethodMetadata)) {
throw new XOException("Only primitive properties are allowed to be used for indexing.");
}
return new IndexedPropertyMethodMetadata<>((PropertyMethod) annotatedMethod, (PrimitivePropertyMethodMetadata) methodMetadata,
metadataFactory.createIndexedPropertyMetadata((PropertyMethod) annotatedMethod));
}
}
return null;
} | java | private IndexedPropertyMethodMetadata<?> getIndexedPropertyMethodMetadata(Collection<MethodMetadata<?, ?>> methodMetadataOfType) {
for (MethodMetadata methodMetadata : methodMetadataOfType) {
AnnotatedMethod annotatedMethod = methodMetadata.getAnnotatedMethod();
Annotation indexedAnnotation = annotatedMethod.getByMetaAnnotation(IndexDefinition.class);
if (indexedAnnotation != null) {
if (!(methodMetadata instanceof PrimitivePropertyMethodMetadata)) {
throw new XOException("Only primitive properties are allowed to be used for indexing.");
}
return new IndexedPropertyMethodMetadata<>((PropertyMethod) annotatedMethod, (PrimitivePropertyMethodMetadata) methodMetadata,
metadataFactory.createIndexedPropertyMetadata((PropertyMethod) annotatedMethod));
}
}
return null;
} | [
"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
// information also to be applied to setters
for (AnnotatedMethod annotatedMethod : annotatedMethods) {
MethodMetadata<?, ?> methodMetadata;
ImplementedBy implementedBy = annotatedMethod.getAnnotation(ImplementedBy.class);
ResultOf resultOf = annotatedMethod.getAnnotation(ResultOf.class);
if (implementedBy != null) {
methodMetadata = new ImplementedByMethodMetadata<>(annotatedMethod, implementedBy.value(),
metadataFactory.createImplementedByMetadata(annotatedMethod));
} else if (resultOf != null) {
methodMetadata = createResultOfMetadata(annotatedMethod, resultOf);
} else if (annotatedMethod instanceof PropertyMethod) {
PropertyMethod propertyMethod = (PropertyMethod) annotatedMethod;
Transient transientAnnotation = propertyMethod.getAnnotationOfProperty(Transient.class);
if (transientAnnotation != null) {
methodMetadata = new TransientPropertyMethodMetadata(propertyMethod);
} else {
methodMetadata = createPropertyMethodMetadata(annotatedType, propertyMethod);
}
} else {
methodMetadata = new UnsupportedOperationMethodMetadata((UserMethod) annotatedMethod);
}
methodMetadataOfType.add(methodMetadata);
}
return methodMetadataOfType;
} | 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
// information also to be applied to setters
for (AnnotatedMethod annotatedMethod : annotatedMethods) {
MethodMetadata<?, ?> methodMetadata;
ImplementedBy implementedBy = annotatedMethod.getAnnotation(ImplementedBy.class);
ResultOf resultOf = annotatedMethod.getAnnotation(ResultOf.class);
if (implementedBy != null) {
methodMetadata = new ImplementedByMethodMetadata<>(annotatedMethod, implementedBy.value(),
metadataFactory.createImplementedByMetadata(annotatedMethod));
} else if (resultOf != null) {
methodMetadata = createResultOfMetadata(annotatedMethod, resultOf);
} else if (annotatedMethod instanceof PropertyMethod) {
PropertyMethod propertyMethod = (PropertyMethod) annotatedMethod;
Transient transientAnnotation = propertyMethod.getAnnotationOfProperty(Transient.class);
if (transientAnnotation != null) {
methodMetadata = new TransientPropertyMethodMetadata(propertyMethod);
} else {
methodMetadata = createPropertyMethodMetadata(annotatedType, propertyMethod);
}
} else {
methodMetadata = new UnsupportedOperationMethodMetadata((UserMethod) annotatedMethod);
}
methodMetadataOfType.add(methodMetadata);
}
return methodMetadataOfType;
} | [
"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 = dependencyProvider.getDependencies(element);
queue.addAll(dependencies);
blockedBy.put(element, dependencies);
queue.remove(element);
allElements.add(element);
}
List<T> result = new LinkedList<>();
for (T element : allElements) {
resolve(element, result);
}
return result;
} | 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 = dependencyProvider.getDependencies(element);
queue.addAll(dependencies);
blockedBy.put(element, dependencies);
queue.remove(element);
allElements.add(element);
}
List<T> result = new LinkedList<>();
for (T element : allElements) {
resolve(element, result);
}
return result;
} | [
"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 : type.getProperties()) {
if (methodMetadata instanceof AbstractRelationPropertyMethodMetadata) {
AbstractRelationPropertyMethodMetadata<?> relationPropertyMethodMetadata = (AbstractRelationPropertyMethodMetadata) methodMetadata;
RelationTypeMetadata<RelationshipMetadata<RemoteRelationshipType>> relationshipMetadata = relationPropertyMethodMetadata
.getRelationshipMetadata();
RemoteRelationshipType relationshipType = relationshipMetadata.getDatastoreMetadata().getDiscriminator();
RelationTypeMetadata.Direction direction = relationPropertyMethodMetadata.getDirection();
RemoteDirection remoteDirection;
switch (direction) {
case FROM:
remoteDirection = RemoteDirection.OUTGOING;
break;
case TO:
remoteDirection = RemoteDirection.INCOMING;
break;
default:
throw new XOException("Unsupported direction: " + direction);
}
if (nodeState.getRelationships(remoteDirection, relationshipType) == null) {
nodeState.setRelationships(remoteDirection, relationshipType, new StateTracker<>(new LinkedHashSet<>()));
}
}
}
}
} | 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 : type.getProperties()) {
if (methodMetadata instanceof AbstractRelationPropertyMethodMetadata) {
AbstractRelationPropertyMethodMetadata<?> relationPropertyMethodMetadata = (AbstractRelationPropertyMethodMetadata) methodMetadata;
RelationTypeMetadata<RelationshipMetadata<RemoteRelationshipType>> relationshipMetadata = relationPropertyMethodMetadata
.getRelationshipMetadata();
RemoteRelationshipType relationshipType = relationshipMetadata.getDatastoreMetadata().getDiscriminator();
RelationTypeMetadata.Direction direction = relationPropertyMethodMetadata.getDirection();
RemoteDirection remoteDirection;
switch (direction) {
case FROM:
remoteDirection = RemoteDirection.OUTGOING;
break;
case TO:
remoteDirection = RemoteDirection.INCOMING;
break;
default:
throw new XOException("Unsupported direction: " + direction);
}
if (nodeState.getRelationships(remoteDirection, relationshipType) == null) {
nodeState.setRelationships(remoteDirection, relationshipType, new StateTracker<>(new LinkedHashSet<>()));
}
}
}
}
} | [
"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.warn(message);
break;
case ERROR:
LOGGER.error(message);
break;
default:
throw new XOException("Unsupported log log level " + level);
}
} | 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.warn(message);
break;
case ERROR:
LOGGER.error(message);
break;
default:
throw new XOException("Unsupported log log level " + level);
}
} | [
"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 (value instanceof Collection) {
Collection collection = (Collection) value;
List<Object> values = new ArrayList<>();
for (Object o : collection) {
values.add(convertParameter(o));
}
return values;
}
return value;
} | 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 (value instanceof Collection) {
Collection collection = (Collection) value;
List<Object> values = new ArrayList<>();
for (Object o : collection) {
values.add(convertParameter(o));
}
return values;
}
return value;
} | [
"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();
if (datastoreMetadata.isCreate()) {
L label = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
if (label != null && propertyMethodMetadata != null) {
ensureIndex(session, label, propertyMethodMetadata, datastoreMetadata.isUnique());
}
}
}
} | java | private void ensureIndex(DS session, EntityTypeMetadata<NodeMetadata<L>> entityTypeMetadata,
IndexedPropertyMethodMetadata<IndexedPropertyMetadata> indexedProperty) {
if (indexedProperty != null) {
IndexedPropertyMetadata datastoreMetadata = indexedProperty.getDatastoreMetadata();
if (datastoreMetadata.isCreate()) {
L label = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata = indexedProperty.getPropertyMethodMetadata();
if (label != null && propertyMethodMetadata != null) {
ensureIndex(session, label, propertyMethodMetadata, datastoreMetadata.isUnique());
}
}
}
} | [
"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 constraint for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE", label.getName(), propertyMetadata.getName());
} else {
LOGGER.debug("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE INDEX ON :%s(%s)", label.getName(), propertyMetadata.getName());
}
try (ResultIterator iterator = session.createQuery(Cypher.class).execute(statement, Collections.emptyMap())) {
}
} | java | private void ensureIndex(DS session, L label, PrimitivePropertyMethodMetadata<PropertyMetadata> propertyMethodMetadata, boolean unique) {
PropertyMetadata propertyMetadata = propertyMethodMetadata.getDatastoreMetadata();
String statement;
if (unique) {
LOGGER.debug("Creating constraint for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE CONSTRAINT ON (n:%s) ASSERT n.%s IS UNIQUE", label.getName(), propertyMetadata.getName());
} else {
LOGGER.debug("Creating index for label {} on property '{}'.", label, propertyMetadata.getName());
statement = String.format("CREATE INDEX ON :%s(%s)", label.getName(), propertyMetadata.getName());
}
try (ResultIterator iterator = session.createQuery(Cypher.class).execute(statement, Collections.emptyMap())) {
}
} | [
"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);
evaluateMethod(instanceListener, PostUpdate.class, method, postUpdateMethods);
evaluateMethod(instanceListener, PreDelete.class, method, preDeleteMethods);
evaluateMethod(instanceListener, PostDelete.class, method, postDeleteMethods);
evaluateMethod(instanceListener, PostLoad.class, method, postLoadMethods);
}
} | java | public void registerInstanceListener(Object instanceListener) {
for (Method method : instanceListener.getClass().getMethods()) {
evaluateMethod(instanceListener, PostCreate.class, method, postCreateMethods);
evaluateMethod(instanceListener, PreUpdate.class, method, preUpdateMethods);
evaluateMethod(instanceListener, PostUpdate.class, method, postUpdateMethods);
evaluateMethod(instanceListener, PreDelete.class, method, preDeleteMethods);
evaluateMethod(instanceListener, PostDelete.class, method, postDeleteMethods);
evaluateMethod(instanceListener, PostLoad.class, method, postLoadMethods);
}
} | [
"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.toGenericString() + "' annotated with '" + annotation.getName()
+ "' must declare exactly one parameter but declares " + method.getParameterTypes().length + ".");
}
Set<Method> listenerMethods = methods.get(listener);
if (listenerMethods == null) {
listenerMethods = new HashSet<>();
methods.put(listener, listenerMethods);
}
listenerMethods.add(method);
}
} | 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.toGenericString() + "' annotated with '" + annotation.getName()
+ "' must declare exactly one parameter but declares " + method.getParameterTypes().length + ".");
}
Set<Method> listenerMethods = methods.get(listener);
if (listenerMethods == null) {
listenerMethods = new HashSet<>();
methods.put(listener, listenerMethods);
}
listenerMethods.add(method);
}
} | [
"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 (Method method : listenerMethods) {
Class<?> parameterType = method.getParameterTypes()[0];
if (parameterType.isAssignableFrom(instance.getClass())) {
try {
method.invoke(listener, instance);
} catch (IllegalAccessException e) {
throw new XOException("Cannot access instance listener method " + method.toGenericString(), e);
} catch (InvocationTargetException e) {
throw new XOException("Cannot invoke instance listener method " + method.toGenericString(), e);
}
}
}
}
}
} | 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 (Method method : listenerMethods) {
Class<?> parameterType = method.getParameterTypes()[0];
if (parameterType.isAssignableFrom(instance.getClass())) {
try {
method.invoke(listener, instance);
} catch (IllegalAccessException e) {
throw new XOException("Cannot access instance listener method " + method.toGenericString(), e);
} catch (InvocationTargetException e) {
throw new XOException("Cannot invoke instance listener method " + method.toGenericString(), e);
}
}
}
}
}
} | [
"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 = newInstance(id, datastoreType, types, cacheMode);
if (TransactionalCache.Mode.READ.equals(cacheMode)) {
instanceListenerService.postLoad(instance);
}
}
return (T) instance;
} | 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 = newInstance(id, datastoreType, types, cacheMode);
if (TransactionalCache.Mode.READ.equals(cacheMode)) {
instanceListenerService.postLoad(instance);
}
}
return (T) instance;
} | [
"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.createInstance(invocationHandler, types.getCompositeType());
cache.put(id, instance, cacheMode);
return instance;
} | 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.createInstance(invocationHandler, types.getCompositeType());
cache.put(id, instance, cacheMode);
return instance;
} | [
"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 (dynamicType.isFinal()) {
throw new XOException("Cannot create an instance overriding a final type " + dynamicType);
}
} | 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 (dynamicType.isFinal()) {
throw new XOException("Cannot create an instance overriding a final type " + dynamicType);
}
} | [
"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<>();
Set<RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator>> relations = relationMappings.get(discriminator);
if (relations != null) {
Set<RelationTypeMetadata<RelationMetadata>> relationTypes = new HashSet<>();
for (RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator> relation : relations) {
Set<EntityDiscriminator> source = relation.getSource();
Set<EntityDiscriminator> target = relation.getTarget();
if (sourceDiscriminators.containsAll(source) && targetDiscriminators.containsAll(target)) {
RelationTypeMetadata<RelationMetadata> relationType = relation.getRelationType();
relationTypes.add(relationType);
}
}
dynamicType = new DynamicType<>(relationTypes);
}
return dynamicType;
} | java | public DynamicType<RelationTypeMetadata<RelationMetadata>> getRelationTypes(Set<EntityDiscriminator> sourceDiscriminators,
RelationDiscriminator discriminator, Set<EntityDiscriminator> targetDiscriminators) {
DynamicType<RelationTypeMetadata<RelationMetadata>> dynamicType = new DynamicType<>();
Set<RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator>> relations = relationMappings.get(discriminator);
if (relations != null) {
Set<RelationTypeMetadata<RelationMetadata>> relationTypes = new HashSet<>();
for (RelationMapping<EntityDiscriminator, RelationMetadata, RelationDiscriminator> relation : relations) {
Set<EntityDiscriminator> source = relation.getSource();
Set<EntityDiscriminator> target = relation.getTarget();
if (sourceDiscriminators.containsAll(source) && targetDiscriminators.containsAll(target)) {
RelationTypeMetadata<RelationMetadata> relationType = relation.getRelationType();
relationTypes.add(relationType);
}
}
dynamicType = new DynamicType<>(relationTypes);
}
return 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 = (ExampleProxyMethodService<T>) exampleProxyMethodServices.get(type);
if (proxyMethodService == null) {
proxyMethodService = new ExampleProxyMethodService(type, sessionContext);
exampleProxyMethodServices.put(type, proxyMethodService);
}
InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(exampleEntity, proxyMethodService);
List<Class<?>> effectiveTypes = new ArrayList<>(types.length + 1);
effectiveTypes.add(type);
effectiveTypes.addAll(Arrays.asList(types));
CompositeType compositeType = CompositeTypeBuilder.create(CompositeObject.class, type, types);
T instance = sessionContext.getProxyFactory().createInstance(invocationHandler, compositeType);
example.prepare(instance);
return exampleEntity;
} | 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 = (ExampleProxyMethodService<T>) exampleProxyMethodServices.get(type);
if (proxyMethodService == null) {
proxyMethodService = new ExampleProxyMethodService(type, sessionContext);
exampleProxyMethodServices.put(type, proxyMethodService);
}
InstanceInvocationHandler invocationHandler = new InstanceInvocationHandler(exampleEntity, proxyMethodService);
List<Class<?>> effectiveTypes = new ArrayList<>(types.length + 1);
effectiveTypes.add(type);
effectiveTypes.addAll(Arrays.asList(types));
CompositeType compositeType = CompositeTypeBuilder.create(CompositeObject.class, type, types);
T instance = sessionContext.getProxyFactory().createInstance(invocationHandler, compositeType);
example.prepare(instance);
return exampleEntity;
} | [
"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);
EntityDiscriminator entityDiscriminator = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
if (entityDiscriminator == null) {
throw new XOException("Type " + type.getName() + " has no discriminator (i.e. cannot be identified in datastore).");
}
ResultIterator<Entity> iterator = sessionContext.getDatastoreSession().getDatastoreEntityManager().findEntity(entityTypeMetadata, entityDiscriminator,
entity);
AbstractInstanceManager<EntityId, Entity> entityInstanceManager = sessionContext.getEntityInstanceManager();
ResultIterator<T> resultIterator = new ResultIterator<T>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
Entity entity = iterator.next();
return entityInstanceManager.readInstance(entity);
}
@Override
public void remove() {
throw new UnsupportedOperationException("Cannot remove instance.");
}
@Override
public void close() {
iterator.close();
}
};
XOTransaction xoTransaction = sessionContext.getXOTransaction();
final ResultIterator<T> transactionalIterator = xoTransaction != null ? new TransactionalResultIterator<>(resultIterator, xoTransaction)
: resultIterator;
return sessionContext.getInterceptorFactory().addInterceptor(new AbstractResultIterable<T>() {
@Override
public ResultIterator<T> iterator() {
return transactionalIterator;
}
}, ResultIterable.class);
} | java | private <T> ResultIterable<T> findByExample(Class<?> type, Map<PrimitivePropertyMethodMetadata<PropertyMetadata>, Object> entity) {
sessionContext.getCacheSynchronizationService().flush();
EntityTypeMetadata<EntityMetadata> entityTypeMetadata = sessionContext.getMetadataProvider().getEntityMetadata(type);
EntityDiscriminator entityDiscriminator = entityTypeMetadata.getDatastoreMetadata().getDiscriminator();
if (entityDiscriminator == null) {
throw new XOException("Type " + type.getName() + " has no discriminator (i.e. cannot be identified in datastore).");
}
ResultIterator<Entity> iterator = sessionContext.getDatastoreSession().getDatastoreEntityManager().findEntity(entityTypeMetadata, entityDiscriminator,
entity);
AbstractInstanceManager<EntityId, Entity> entityInstanceManager = sessionContext.getEntityInstanceManager();
ResultIterator<T> resultIterator = new ResultIterator<T>() {
@Override
public boolean hasNext() {
return iterator.hasNext();
}
@Override
public T next() {
Entity entity = iterator.next();
return entityInstanceManager.readInstance(entity);
}
@Override
public void remove() {
throw new UnsupportedOperationException("Cannot remove instance.");
}
@Override
public void close() {
iterator.close();
}
};
XOTransaction xoTransaction = sessionContext.getXOTransaction();
final ResultIterator<T> transactionalIterator = xoTransaction != null ? new TransactionalResultIterator<>(resultIterator, xoTransaction)
: resultIterator;
return sessionContext.getInterceptorFactory().addInterceptor(new AbstractResultIterable<T>() {
@Override
public ResultIterator<T> iterator() {
return transactionalIterator;
}
}, ResultIterable.class);
} | [
"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 = typeMetadata.getDatastoreMetadata().getDiscriminator();
if (discriminator != null) {
discriminators.add(discriminator);
}
for (EntityTypeMetadata<EntityMetadata> superTypeMetadata : aggregatedSuperTypes.get(typeMetadata)) {
discriminator = superTypeMetadata.getDatastoreMetadata().getDiscriminator();
if (discriminator != null) {
discriminators.add(discriminator);
}
}
aggregatedDiscriminators.put(typeMetadata, discriminators);
}
return discriminators;
} | java | private Set<Discriminator> getAggregatedDiscriminators(EntityTypeMetadata<EntityMetadata> typeMetadata) {
Set<Discriminator> discriminators = aggregatedDiscriminators.get(typeMetadata);
if (discriminators == null) {
discriminators = new HashSet<>();
Discriminator discriminator = typeMetadata.getDatastoreMetadata().getDiscriminator();
if (discriminator != null) {
discriminators.add(discriminator);
}
for (EntityTypeMetadata<EntityMetadata> superTypeMetadata : aggregatedSuperTypes.get(typeMetadata)) {
discriminator = superTypeMetadata.getDatastoreMetadata().getDiscriminator();
if (discriminator != null) {
discriminators.add(discriminator);
}
}
aggregatedDiscriminators.put(typeMetadata, discriminators);
}
return discriminators;
} | [
"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 XOException("Access denied to type '" + type.getName() + "'", e);
}
} | 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 XOException("Access denied to type '" + type.getName() + "'", e);
}
} | [
"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 = (ParameterizedType) genericInterface;
if (genericType.equals(parameterizedType.getRawType())) {
Type typeParameter = ((ParameterizedType) genericInterface).getActualTypeArguments()[0];
if (typeParameter instanceof Class<?>) {
return (Class<?>) typeParameter;
}
}
}
}
return null;
} | java | public static Class<?> getTypeParameter(Class<?> genericType, Class<?> type) {
Type[] genericInterfaces = type.getGenericInterfaces();
for (Type genericInterface : genericInterfaces) {
if (genericInterface instanceof ParameterizedType) {
ParameterizedType parameterizedType = (ParameterizedType) genericInterface;
if (genericType.equals(parameterizedType.getRawType())) {
Type typeParameter = ((ParameterizedType) genericInterface).getActualTypeArguments()[0];
if (typeParameter instanceof Class<?>) {
return (Class<?>) typeParameter;
}
}
}
}
return null;
} | [
"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();
Type genericReturnType = method.getGenericReturnType();
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] genericParameterTypes = method.getGenericParameterTypes();
if (PropertyMethod.GET.matches(method)) {
String name = PropertyMethod.GET.getName(method);
getters.put(name, method);
addType(type, name, returnType, genericReturnType);
} else if (PropertyMethod.IS.matches(method)) {
String name = PropertyMethod.IS.getName(method);
getters.put(name, method);
addType(type, name, returnType, genericReturnType);
} else if (PropertyMethod.SET.matches(method)) {
String name = PropertyMethod.SET.getName(method);
setters.put(name, method);
addType(type, name, parameterTypes[0], genericParameterTypes[0]);
} else {
methods.add(method);
}
}
}
List<AnnotatedMethod> typeMethods = new ArrayList<>();
Map<String, GetPropertyMethod> getPropertyMethods = new HashMap<>();
for (Map.Entry<String, Method> methodEntry : getters.entrySet()) {
String name = methodEntry.getKey();
Method getter = methodEntry.getValue();
Class<?> propertyType = types.get(name);
Type genericType = genericTypes.get(name);
GetPropertyMethod getPropertyMethod = new GetPropertyMethod(getter, name, propertyType, genericType);
typeMethods.add(getPropertyMethod);
getPropertyMethods.put(name, getPropertyMethod);
}
for (Map.Entry<String, Method> methodEntry : setters.entrySet()) {
String name = methodEntry.getKey();
Method setter = methodEntry.getValue();
GetPropertyMethod getPropertyMethod = getPropertyMethods.get(name);
Class<?> propertyType = types.get(name);
Type genericType = genericTypes.get(name);
SetPropertyMethod setPropertyMethod = new SetPropertyMethod(setter, getPropertyMethod, name, propertyType, genericType);
typeMethods.add(setPropertyMethod);
}
for (Method method : methods) {
typeMethods.add(new UserMethod(method));
}
return typeMethods;
} | 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();
Type genericReturnType = method.getGenericReturnType();
Class<?>[] parameterTypes = method.getParameterTypes();
Type[] genericParameterTypes = method.getGenericParameterTypes();
if (PropertyMethod.GET.matches(method)) {
String name = PropertyMethod.GET.getName(method);
getters.put(name, method);
addType(type, name, returnType, genericReturnType);
} else if (PropertyMethod.IS.matches(method)) {
String name = PropertyMethod.IS.getName(method);
getters.put(name, method);
addType(type, name, returnType, genericReturnType);
} else if (PropertyMethod.SET.matches(method)) {
String name = PropertyMethod.SET.getName(method);
setters.put(name, method);
addType(type, name, parameterTypes[0], genericParameterTypes[0]);
} else {
methods.add(method);
}
}
}
List<AnnotatedMethod> typeMethods = new ArrayList<>();
Map<String, GetPropertyMethod> getPropertyMethods = new HashMap<>();
for (Map.Entry<String, Method> methodEntry : getters.entrySet()) {
String name = methodEntry.getKey();
Method getter = methodEntry.getValue();
Class<?> propertyType = types.get(name);
Type genericType = genericTypes.get(name);
GetPropertyMethod getPropertyMethod = new GetPropertyMethod(getter, name, propertyType, genericType);
typeMethods.add(getPropertyMethod);
getPropertyMethods.put(name, getPropertyMethod);
}
for (Map.Entry<String, Method> methodEntry : setters.entrySet()) {
String name = methodEntry.getKey();
Method setter = methodEntry.getValue();
GetPropertyMethod getPropertyMethod = getPropertyMethods.get(name);
Class<?> propertyType = types.get(name);
Type genericType = genericTypes.get(name);
SetPropertyMethod setPropertyMethod = new SetPropertyMethod(setter, getPropertyMethod, name, propertyType, genericType);
typeMethods.add(setPropertyMethod);
}
for (Method method : methods) {
typeMethods.add(new UserMethod(method));
}
return typeMethods;
} | [
"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 from DOM element
Link link = getAnchorLink(element);
// build anchor for link metadata
Element anchorElement = buildAnchorElement(link, element);
// Replace anchor tag or remove anchor tag if invalid - add any sub-content in every case
List<Content> content = new ArrayList<Content>();
if (anchorElement != null) {
anchorElement.addContent(element.cloneContent());
content.add(anchorElement);
}
else {
content.addAll(element.getContent());
}
return content;
} | 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 from DOM element
Link link = getAnchorLink(element);
// build anchor for link metadata
Element anchorElement = buildAnchorElement(link, element);
// Replace anchor tag or remove anchor tag if invalid - add any sub-content in every case
List<Content> content = new ArrayList<Content>();
if (anchorElement != null) {
anchorElement.addContent(element.cloneContent());
content.add(anchorElement);
}
else {
content.addAll(element.getContent());
}
return content;
} | [
"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 (StringUtils.isNotEmpty(metadataString)) {
try {
metadata = new JSONObject(metadataString);
}
catch (JSONException ex) {
log.debug("Invalid link metadata: " + metadataString, ex);
}
}
}
if (metadata != null) {
JSONArray names = metadata.names();
for (int i = 0; i < names.length(); i++) {
String name = names.optString(i);
resourceProps.put(name, metadata.opt(name));
foundAny = true;
}
}
return foundAny;
} | 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 (StringUtils.isNotEmpty(metadataString)) {
try {
metadata = new JSONObject(metadataString);
}
catch (JSONException ex) {
log.debug("Invalid link metadata: " + metadataString, ex);
}
}
}
if (metadata != null) {
JSONArray names = metadata.names();
for (int i = 0; i < names.length(); i++) {
String name = names.optString(i);
resourceProps.put(name, metadata.opt(name));
foundAny = true;
}
}
return foundAny;
} | [
"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 || href.startsWith("#")) {
return;
}
// get link metadata from rel element
JSONObject metadata = null;
String metadataString = element.getAttributeValue("rel");
if (StringUtils.isNotEmpty(metadataString)) {
try {
metadata = new JSONObject(metadataString);
}
catch (JSONException ex) {
log.debug("Invalid link metadata: " + metadataString, ex);
}
}
if (metadata == null) {
metadata = new JSONObject();
}
// transform link metadata to virtual JCR resource with JCR properties
JSONArray metadataPropertyNames = metadata.names();
if (metadataPropertyNames != null) {
for (int i = 0; i < metadataPropertyNames.length(); i++) {
String metadataPropertyName = metadataPropertyNames.optString(i);
// check if value is array
JSONArray valueArray = metadata.optJSONArray(metadataPropertyName);
if (valueArray != null) {
// store array values
List<String> values = new ArrayList<String>();
for (int j = 0; j < valueArray.length(); j++) {
values.add(valueArray.optString(j));
}
resourceProps.put(metadataPropertyName, values.toArray(new String[values.size()]));
}
else {
// store simple value
Object value = metadata.opt(metadataPropertyName);
if (value != null) {
resourceProps.put(metadataPropertyName, value);
}
}
}
}
// detect link type
LinkType linkType = null;
String linkTypeString = resourceProps.get(LinkNameConstants.PN_LINK_TYPE, String.class);
for (Class<? extends LinkType> candidateClass : linkHandlerConfig.getLinkTypes()) {
LinkType candidate = AdaptTo.notNull(adaptable, candidateClass);
if (StringUtils.isNotEmpty(linkTypeString)) {
if (StringUtils.equals(linkTypeString, candidate.getId())) {
linkType = candidate;
break;
}
}
else if (candidate.accepts(href)) {
linkType = candidate;
break;
}
}
if (linkType == null) {
// skip further processing if link type was not detected
return;
}
// workaround: strip off ".html" extension if it was added automatically by the RTE
if (linkType instanceof InternalLinkType || linkType instanceof MediaLinkType) {
String htmlSuffix = "." + FileExtension.HTML;
if (StringUtils.endsWith(href, htmlSuffix)) {
href = StringUtils.substringBeforeLast(href, htmlSuffix);
}
}
// store link reference (property depending on link type)
resourceProps.put(linkType.getPrimaryLinkRefProperty(), href);
resourceProps.put(LinkNameConstants.PN_LINK_WINDOW_TARGET, linkWindowTarget);
} | 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 || href.startsWith("#")) {
return;
}
// get link metadata from rel element
JSONObject metadata = null;
String metadataString = element.getAttributeValue("rel");
if (StringUtils.isNotEmpty(metadataString)) {
try {
metadata = new JSONObject(metadataString);
}
catch (JSONException ex) {
log.debug("Invalid link metadata: " + metadataString, ex);
}
}
if (metadata == null) {
metadata = new JSONObject();
}
// transform link metadata to virtual JCR resource with JCR properties
JSONArray metadataPropertyNames = metadata.names();
if (metadataPropertyNames != null) {
for (int i = 0; i < metadataPropertyNames.length(); i++) {
String metadataPropertyName = metadataPropertyNames.optString(i);
// check if value is array
JSONArray valueArray = metadata.optJSONArray(metadataPropertyName);
if (valueArray != null) {
// store array values
List<String> values = new ArrayList<String>();
for (int j = 0; j < valueArray.length(); j++) {
values.add(valueArray.optString(j));
}
resourceProps.put(metadataPropertyName, values.toArray(new String[values.size()]));
}
else {
// store simple value
Object value = metadata.opt(metadataPropertyName);
if (value != null) {
resourceProps.put(metadataPropertyName, value);
}
}
}
}
// detect link type
LinkType linkType = null;
String linkTypeString = resourceProps.get(LinkNameConstants.PN_LINK_TYPE, String.class);
for (Class<? extends LinkType> candidateClass : linkHandlerConfig.getLinkTypes()) {
LinkType candidate = AdaptTo.notNull(adaptable, candidateClass);
if (StringUtils.isNotEmpty(linkTypeString)) {
if (StringUtils.equals(linkTypeString, candidate.getId())) {
linkType = candidate;
break;
}
}
else if (candidate.accepts(href)) {
linkType = candidate;
break;
}
}
if (linkType == null) {
// skip further processing if link type was not detected
return;
}
// workaround: strip off ".html" extension if it was added automatically by the RTE
if (linkType instanceof InternalLinkType || linkType instanceof MediaLinkType) {
String htmlSuffix = "." + FileExtension.HTML;
if (StringUtils.endsWith(href, htmlSuffix)) {
href = StringUtils.substringBeforeLast(href, htmlSuffix);
}
}
// store link reference (property depending on link type)
resourceProps.put(linkType.getPrimaryLinkRefProperty(), href);
resourceProps.put(LinkNameConstants.PN_LINK_WINDOW_TARGET, linkWindowTarget);
} | [
"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<Content>();
if (imageElement != null) {
content.add(imageElement);
}
return content;
} | 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<Content>();
if (imageElement != null) {
content.add(imageElement);
}
return content;
} | [
"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!
// remove default servlet extension that is needed for inline images in RTE
unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/" + JcrConstants.JCR_CONTENT + ".default");
unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/_jcr_content.default");
}
return unexternalizedRef;
} | 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!
// remove default servlet extension that is needed for inline images in RTE
unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/" + JcrConstants.JCR_CONTENT + ".default");
unexternalizedRef = StringUtils.removeEnd(unexternalizedRef, "/_jcr_content.default");
}
return unexternalizedRef;
} | [
"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-generated web renditions unless allowed via mediaargs
boolean isIncludeAssetWebRenditions = mediaArgs.isIncludeAssetWebRenditions() != null
? mediaArgs.isIncludeAssetWebRenditions()
: true;
if (!isIncludeAssetWebRenditions && AssetRendition.isWebRendition(rendition)) {
return;
}
RenditionMetadata renditionMetadata = createRenditionMetadata(rendition);
candidates.add(renditionMetadata);
} | 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-generated web renditions unless allowed via mediaargs
boolean isIncludeAssetWebRenditions = mediaArgs.isIncludeAssetWebRenditions() != null
? mediaArgs.isIncludeAssetWebRenditions()
: true;
if (!isIncludeAssetWebRenditions && AssetRendition.isWebRendition(rendition)) {
return;
}
RenditionMetadata renditionMetadata = createRenditionMetadata(rendition);
candidates.add(renditionMetadata);
} | [
"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) {
return allRenditions;
}
// otherwise return those with matching extensions
Set<RenditionMetadata> matchingRenditions = new TreeSet<RenditionMetadata>();
for (RenditionMetadata rendition : allRenditions) {
for (String fileExtension : fileExtensions) {
if (StringUtils.equalsIgnoreCase(fileExtension, rendition.getFileExtension())) {
matchingRenditions.add(rendition);
break;
}
}
}
return matchingRenditions;
} | 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) {
return allRenditions;
}
// otherwise return those with matching extensions
Set<RenditionMetadata> matchingRenditions = new TreeSet<RenditionMetadata>();
for (RenditionMetadata rendition : allRenditions) {
for (String fileExtension : fileExtensions) {
if (StringUtils.equalsIgnoreCase(fileExtension, rendition.getFileExtension())) {
matchingRenditions.add(rendition);
break;
}
}
}
return matchingRenditions;
} | [
"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(ImmutableList.copyOf(mediaArgs.getFileExtensions()));
}
// get file extensions from media formats
final Set<String> mediaFormatFileExtensions = new HashSet<String>();
visitMediaFormats(mediaArgs, new MediaFormatVisitor<Object>() {
@Override
public Object visit(MediaFormat mediaFormat) {
if (mediaFormat.getExtensions() != null && mediaFormat.getExtensions().length > 0) {
mediaFormatFileExtensions.addAll(ImmutableList.copyOf(mediaFormat.getExtensions()));
}
return null;
}
});
// if extensions are defined both in mediaargs and media formats use intersection of both
final String[] fileExtensions;
if (!mediaArgsFileExtensions.isEmpty() && !mediaFormatFileExtensions.isEmpty()) {
Collection<String> intersection = Sets.intersection(mediaArgsFileExtensions, mediaFormatFileExtensions);
if (intersection.isEmpty()) {
// not intersected file extensions - return null to singal no valid file extension request
return null;
}
else {
fileExtensions = intersection.toArray(new String[intersection.size()]);
}
}
else if (!mediaArgsFileExtensions.isEmpty()) {
fileExtensions = mediaArgsFileExtensions.toArray(new String[mediaArgsFileExtensions.size()]);
}
else {
fileExtensions = mediaFormatFileExtensions.toArray(new String[mediaFormatFileExtensions.size()]);
}
return fileExtensions;
} | 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(ImmutableList.copyOf(mediaArgs.getFileExtensions()));
}
// get file extensions from media formats
final Set<String> mediaFormatFileExtensions = new HashSet<String>();
visitMediaFormats(mediaArgs, new MediaFormatVisitor<Object>() {
@Override
public Object visit(MediaFormat mediaFormat) {
if (mediaFormat.getExtensions() != null && mediaFormat.getExtensions().length > 0) {
mediaFormatFileExtensions.addAll(ImmutableList.copyOf(mediaFormat.getExtensions()));
}
return null;
}
});
// if extensions are defined both in mediaargs and media formats use intersection of both
final String[] fileExtensions;
if (!mediaArgsFileExtensions.isEmpty() && !mediaFormatFileExtensions.isEmpty()) {
Collection<String> intersection = Sets.intersection(mediaArgsFileExtensions, mediaFormatFileExtensions);
if (intersection.isEmpty()) {
// not intersected file extensions - return null to singal no valid file extension request
return null;
}
else {
fileExtensions = intersection.toArray(new String[intersection.size()]);
}
}
else if (!mediaArgsFileExtensions.isEmpty()) {
fileExtensions = mediaArgsFileExtensions.toArray(new String[mediaArgsFileExtensions.size()]);
}
else {
fileExtensions = mediaFormatFileExtensions.toArray(new String[mediaFormatFileExtensions.size()]);
}
return fileExtensions;
} | [
"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 fulfillable. | [
"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.matches(mediaArgs.getFixedWidth(), mediaArgs.getFixedHeight())) {
return candidate;
}
}
}
// otherwise check for media format restriction
else if (mediaArgs.getMediaFormats() != null && mediaArgs.getMediaFormats().length > 0) {
return visitMediaFormats(mediaArgs, new MediaFormatVisitor<RenditionMetadata>() {
@Override
public RenditionMetadata visit(MediaFormat mediaFormat) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches((int)mediaFormat.getEffectiveMinWidth(),
(int)mediaFormat.getEffectiveMinHeight(),
(int)mediaFormat.getEffectiveMaxWidth(),
(int)mediaFormat.getEffectiveMaxHeight(),
mediaFormat.getRatio())) {
candidate.setMediaFormat(mediaFormat);
return candidate;
}
}
return null;
}
});
}
// no restriction - return original or first rendition
else {
return getOriginalOrFirstRendition(candidates);
}
// none found
return null;
} | 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.matches(mediaArgs.getFixedWidth(), mediaArgs.getFixedHeight())) {
return candidate;
}
}
}
// otherwise check for media format restriction
else if (mediaArgs.getMediaFormats() != null && mediaArgs.getMediaFormats().length > 0) {
return visitMediaFormats(mediaArgs, new MediaFormatVisitor<RenditionMetadata>() {
@Override
public RenditionMetadata visit(MediaFormat mediaFormat) {
for (RenditionMetadata candidate : candidates) {
if (candidate.matches((int)mediaFormat.getEffectiveMinWidth(),
(int)mediaFormat.getEffectiveMinHeight(),
(int)mediaFormat.getEffectiveMaxWidth(),
(int)mediaFormat.getEffectiveMaxHeight(),
mediaFormat.getRatio())) {
candidate.setMediaFormat(mediaFormat);
return candidate;
}
}
return null;
}
});
}
// no restriction - return original or first rendition
else {
return getOriginalOrFirstRendition(candidates);
}
// none found
return null;
} | [
"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 {
return null;
}
} | 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 {
return null;
}
} | [
"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(mediaFormat);
if (returnValue != null) {
return returnValue;
}
}
}
return null;
} | 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(mediaFormat);
if (returnValue != null) {
return returnValue;
}
}
}
return null;
} | [
"@",
"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 format visitor, if any returned a value that is not null | [
"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.getMediaFormats()) {
MediaArgs renditionMediaArgs = mediaArgs.clone();
renditionMediaArgs.mediaFormat(mediaFormat);
renditionMediaArgs.mediaFormatsMandatory(false);
Rendition rendition = asset.getRendition(renditionMediaArgs);
if (rendition != null) {
resolvedRenditions.add(rendition);
anyResolved = true;
}
else {
allResolved = false;
}
}
media.setRenditions(resolvedRenditions);
if (!resolvedRenditions.isEmpty()) {
media.setUrl(resolvedRenditions.get(0).getUrl());
}
if (allMandatory) {
return allResolved;
}
else {
return anyResolved;
}
} | 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.getMediaFormats()) {
MediaArgs renditionMediaArgs = mediaArgs.clone();
renditionMediaArgs.mediaFormat(mediaFormat);
renditionMediaArgs.mediaFormatsMandatory(false);
Rendition rendition = asset.getRendition(renditionMediaArgs);
if (rendition != null) {
resolvedRenditions.add(rendition);
anyResolved = true;
}
else {
allResolved = false;
}
}
media.setRenditions(resolvedRenditions);
if (!resolvedRenditions.isEmpty()) {
media.setUrl(resolvedRenditions.get(0).getUrl());
}
if (allMandatory) {
return allResolved;
}
else {
return anyResolved;
}
} | [
"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.toString());
} | 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.toString());
} | [
"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 instance (performance optimization - if medialib items changes
// users have to refresh browsers cache)
return CacheHeader.isNotModified(resource, request, response, false);
} | 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 instance (performance optimization - if medialib items changes
// users have to refresh browsers cache)
return CacheHeader.isNotModified(resource, request, response, false);
} | [
"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 "force download" selector
if (RequestPath.hasSelector(request, SELECTOR_DOWNLOAD)) {
// Overwrite MIME type with one suited for downloads
response.setContentType(ContentType.DOWNLOAD);
// Construct disposition header
StringBuilder dispositionHeader = new StringBuilder("attachment;");
String suffix = request.getRequestPathInfo().getSuffix();
suffix = StringUtils.stripStart(suffix, "/");
if (StringUtils.isNotEmpty(suffix)) {
dispositionHeader.append("filename=\"").append(suffix).append('\"');
}
response.setHeader(HEADER_CONTENT_DISPOSITION, dispositionHeader.toString());
}
// write binary data
OutputStream out = response.getOutputStream();
out.write(binaryData);
out.flush();
} | 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 "force download" selector
if (RequestPath.hasSelector(request, SELECTOR_DOWNLOAD)) {
// Overwrite MIME type with one suited for downloads
response.setContentType(ContentType.DOWNLOAD);
// Construct disposition header
StringBuilder dispositionHeader = new StringBuilder("attachment;");
String suffix = request.getRequestPathInfo().getSuffix();
suffix = StringUtils.stripStart(suffix, "/");
if (StringUtils.isNotEmpty(suffix)) {
dispositionHeader.append("filename=\"").append(suffix).append('\"');
}
response.setHeader(HEADER_CONTENT_DISPOSITION, dispositionHeader.toString());
}
// write binary data
OutputStream out = response.getOutputStream();
out.write(binaryData);
out.flush();
} | [
"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,
ratio,
ratioWidth,
ratioHeight,
fileSizeMax,
nonNullArray(extensions),
renditionGroup,
download,
internal,
ranking,
ImmutableValueMap.copyOf(properties));
} | 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,
ratio,
ratioWidth,
ratioHeight,
fileSizeMax,
nonNullArray(extensions),
renditionGroup,
download,
internal,
ranking,
ImmutableValueMap.copyOf(properties));
} | [
"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);
}
return img;
} | 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);
}
return img;
} | [
"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);
}
else {
log.warn("DAM video profile with name '{}' does not exist.", profileName);
}
}
return profiles;
} | 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);
}
else {
log.warn("DAM video profile with name '{}' does not exist.", profileName);
}
}
return profiles;
} | [
"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.createSource()
.setType(profile.getHtmlType())
.setSrc(urlHandler.get(rendition.getPath()).buildExternalResourceUrl(rendition.adaptTo(Resource.class)));
}
}
} | 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.createSource()
.setType(profile.getHtmlType())
.setSrc(urlHandler.get(rendition.getPath()).buildExternalResourceUrl(rendition.adaptTo(Resource.class)));
}
}
} | [
"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 (rendition == null) {
return null;
}
String playerUrl = urlHandler.get("/etc/clientlibs/foundation/video/swf/StrobeMediaPlayback.swf")
.buildExternalResourceUrl();
// strobe specialty: path must be relative to swf file
String renditionUrl = "../../../../.." + rendition.getPath();
// manually apply jcr_content namespace mangling
renditionUrl = StringUtils.replace(renditionUrl, JcrConstants.JCR_CONTENT, "_jcr_content");
HtmlElement object = new HtmlElement("object");
object.setAttribute("type", ContentType.SWF);
object.setAttribute("data", playerUrl);
object.setAttribute("width", Long.toString(dimension.getWidth()));
object.setAttribute("height", Long.toString(dimension.getHeight()));
// get flashvars
Map<String, String> flashvars = new HashMap<String, String>();
flashvars.put("src", renditionUrl);
flashvars.putAll(getAdditionalFlashPlayerFlashVars(media, dimension));
// get flash parameters
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("movie", playerUrl);
parameters.put("flashvars", buildFlashVarsString(flashvars));
parameters.putAll(getAdditionalFlashPlayerParameters(media, dimension));
// set parameters on object element
for (Map.Entry<String, String> entry : parameters.entrySet()) {
HtmlElement param = object.create("param");
param.setAttribute("name", entry.getKey());
param.setAttribute("value", entry.getValue());
}
return object;
} | 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 (rendition == null) {
return null;
}
String playerUrl = urlHandler.get("/etc/clientlibs/foundation/video/swf/StrobeMediaPlayback.swf")
.buildExternalResourceUrl();
// strobe specialty: path must be relative to swf file
String renditionUrl = "../../../../.." + rendition.getPath();
// manually apply jcr_content namespace mangling
renditionUrl = StringUtils.replace(renditionUrl, JcrConstants.JCR_CONTENT, "_jcr_content");
HtmlElement object = new HtmlElement("object");
object.setAttribute("type", ContentType.SWF);
object.setAttribute("data", playerUrl);
object.setAttribute("width", Long.toString(dimension.getWidth()));
object.setAttribute("height", Long.toString(dimension.getHeight()));
// get flashvars
Map<String, String> flashvars = new HashMap<String, String>();
flashvars.put("src", renditionUrl);
flashvars.putAll(getAdditionalFlashPlayerFlashVars(media, dimension));
// get flash parameters
Map<String, String> parameters = new HashMap<String, String>();
parameters.put("movie", playerUrl);
parameters.put("flashvars", buildFlashVarsString(flashvars));
parameters.putAll(getAdditionalFlashPlayerParameters(media, dimension));
// set parameters on object element
for (Map.Entry<String, String> entry : parameters.entrySet()) {
HtmlElement param = object.create("param");
param.setAttribute("name", entry.getKey());
param.setAttribute("value", entry.getValue());
}
return object;
} | [
"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 = flashvarsIterator.next();
flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8));
flashvarsString.append('=');
flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8));
if (flashvarsIterator.hasNext()) {
flashvarsString.append('&');
}
}
return flashvarsString.toString();
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Unsupported encoding.", ex);
}
} | 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 = flashvarsIterator.next();
flashvarsString.append(URLEncoder.encode(entry.getKey(), CharEncoding.UTF_8));
flashvarsString.append('=');
flashvarsString.append(URLEncoder.encode(entry.getValue(), CharEncoding.UTF_8));
if (flashvarsIterator.hasNext()) {
flashvarsString.append('&');
}
}
return flashvarsString.toString();
}
catch (UnsupportedEncodingException ex) {
throw new RuntimeException("Unsupported encoding.", ex);
}
} | [
"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.notNull(currentPage, Resource.class);
ResourceResolver resourceResolver = currentResource.getResourceResolver();
String currentSiteRoot = getRootPath(currentPage.getPath(), urlHandlerConfig.getSiteRootLevel(currentResource), resourceResolver);
String pathSiteRoot = getRootPath(targetResource.getPath(), urlHandlerConfig.getSiteRootLevel(targetResource), resourceResolver);
boolean notInCurrentSite = !StringUtils.equals(currentSiteRoot, pathSiteRoot);
if (notInCurrentSite) {
UrlConfig targetUrlConfig = new UrlConfig(targetResource);
return targetUrlConfig.isValid();
}
else {
return false;
}
} | 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.notNull(currentPage, Resource.class);
ResourceResolver resourceResolver = currentResource.getResourceResolver();
String currentSiteRoot = getRootPath(currentPage.getPath(), urlHandlerConfig.getSiteRootLevel(currentResource), resourceResolver);
String pathSiteRoot = getRootPath(targetResource.getPath(), urlHandlerConfig.getSiteRootLevel(targetResource), resourceResolver);
boolean notInCurrentSite = !StringUtils.equals(currentSiteRoot, pathSiteRoot);
if (notInCurrentSite) {
UrlConfig targetUrlConfig = new UrlConfig(targetResource);
return targetUrlConfig.isValid();
}
else {
return false;
}
} | [
"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 resources is located in another site/context with separate url configuration | [
"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 scaleHeight = (requestedDimension.getHeight() > 0
&& requestedDimension.getHeight() != originalDimension.getHeight());
if (scaleWidth || scaleHeight) {
long requestedWidth = requestedDimension.getWidth();
long requestedHeight = requestedDimension.getHeight();
// calculate missing width/height from ratio if not specified
double imageRatio = (double)originalDimension.getWidth() / (double)originalDimension.getHeight();
if (requestedWidth == 0 && requestedHeight > 0) {
requestedWidth = (int)Math.round(requestedHeight * imageRatio);
}
else if (requestedWidth > 0 && requestedHeight == 0) {
requestedHeight = (int)Math.round(requestedWidth / imageRatio);
}
// calculate requested ratio
double requestedRatio = (double)requestedWidth / (double)requestedHeight;
// if ratio does not match, or requested width/height is larger than the original image scaling is not possible
if (!Ratio.matches(imageRatio, requestedRatio)
|| (originalDimension.getWidth() < requestedWidth)
|| (originalDimension.getHeight() < requestedHeight)) {
return SCALING_NOT_POSSIBLE_DIMENSION;
}
else {
return new Dimension(requestedWidth, requestedHeight);
}
}
return null;
} | 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 scaleHeight = (requestedDimension.getHeight() > 0
&& requestedDimension.getHeight() != originalDimension.getHeight());
if (scaleWidth || scaleHeight) {
long requestedWidth = requestedDimension.getWidth();
long requestedHeight = requestedDimension.getHeight();
// calculate missing width/height from ratio if not specified
double imageRatio = (double)originalDimension.getWidth() / (double)originalDimension.getHeight();
if (requestedWidth == 0 && requestedHeight > 0) {
requestedWidth = (int)Math.round(requestedHeight * imageRatio);
}
else if (requestedWidth > 0 && requestedHeight == 0) {
requestedHeight = (int)Math.round(requestedWidth / imageRatio);
}
// calculate requested ratio
double requestedRatio = (double)requestedWidth / (double)requestedHeight;
// if ratio does not match, or requested width/height is larger than the original image scaling is not possible
if (!Ratio.matches(imageRatio, requestedRatio)
|| (originalDimension.getWidth() < requestedWidth)
|| (originalDimension.getHeight() < requestedHeight)) {
return SCALING_NOT_POSSIBLE_DIMENSION;
}
else {
return new Dimension(requestedWidth, requestedHeight);
}
}
return null;
} | [
"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(SCALING_NOT_POSSIBLE_DIMENSION)) {
return null;
}
// otherwise generate scaled image URL
return buildScaledMediaUrl(scaledDimension, this.media.getCropDimension());
}
// if no scaling but cropping required builid scaled image URL
if (this.media.getCropDimension() != null) {
return buildScaledMediaUrl(this.media.getCropDimension(), this.media.getCropDimension());
}
if (mediaArgs.isContentDispositionAttachment()) {
// if not scaling and no cropping required but special content disposition headers required build download url
return buildDownloadMediaUrl();
}
else {
// if not scaling and no cropping required build native media URL
return buildNativeMediaUrl();
}
} | 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(SCALING_NOT_POSSIBLE_DIMENSION)) {
return null;
}
// otherwise generate scaled image URL
return buildScaledMediaUrl(scaledDimension, this.media.getCropDimension());
}
// if no scaling but cropping required builid scaled image URL
if (this.media.getCropDimension() != null) {
return buildScaledMediaUrl(this.media.getCropDimension(), this.media.getCropDimension());
}
if (mediaArgs.isContentDispositionAttachment()) {
// if not scaling and no cropping required but special content disposition headers required build download url
return buildDownloadMediaUrl();
}
else {
// if not scaling and no cropping required build native media URL
return buildNativeMediaUrl();
}
} | [
"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(parentResource.getName(), getFileName())) {
path = parentResource.getPath();
}
// otherwise use nt:file node path with custom filename
else {
path = parentResource.getPath() + "./" + getFileName();
}
}
else {
// nt:resource node does not have a nt:file parent, use its path directly
path = this.resource.getPath() + "./" + getFileName();
}
// build externalized URL
UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
} | 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(parentResource.getName(), getFileName())) {
path = parentResource.getPath();
}
// otherwise use nt:file node path with custom filename
else {
path = parentResource.getPath() + "./" + getFileName();
}
}
else {
// nt:resource node does not have a nt:file parent, use its path directly
path = this.resource.getPath() + "./" + getFileName();
}
// build externalized URL
UrlHandler urlHandler = AdaptTo.notNull(this.adaptable, UrlHandler.class);
return urlHandler.get(path).urlMode(this.mediaArgs.getUrlMode()).buildExternalResourceUrl(this.resource);
} | [
"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.