code
stringlengths 25
201k
| docstring
stringlengths 19
96.2k
| func_name
stringlengths 0
235
| language
stringclasses 1
value | repo
stringlengths 8
51
| path
stringlengths 11
314
| url
stringlengths 62
377
| license
stringclasses 7
values |
|---|---|---|---|---|---|---|---|
@Override
public MapAssert<String, Object> variables() {
return super.variables();
}
|
Enter into a chained map assert inspecting the variables currently available in the context of the case task instance
under test of this CaseTaskAssert.
@return MapAssert(String, Object) inspecting the case task instance variables. Inspecting an empty map in case no such variables
are available.
|
variables
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CaseTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CaseTaskAssert.java
|
Apache-2.0
|
public static CaseInstanceAssert assertThat(final CaseInstance actual) {
return CaseInstanceAssert.assertThat(processEngine(), actual);
}
|
Assert that... the given CaseInstance meets your expectations.
@param actual CaseInstance under test
@return Assert object offering CaseInstance specific assertions.
|
assertThat
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseExecutionAssert assertThat(final CaseExecution actual) {
return CaseExecutionAssert.assertThat(processEngine(), actual);
}
|
Assert that... the given CaseExecution meets your expectations.
@param actual CaseExecution under test
@return Assert object offering CaseExecution specific assertions.
|
assertThat
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseDefinitionAssert assertThat(final CaseDefinition actual) {
return CaseDefinitionAssert.assertThat(processEngine(), actual);
}
|
Assert that... the given CaseDefinition meets your expectations.
@param actual ProcessDefinition under test
@return Assert object offering ProcessDefinition specific assertions.
|
assertThat
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseService caseService() {
return processEngine().getCaseService();
}
|
Helper method to easily access CaseService
@return CaseService of process engine bound to this testing thread
@see org.camunda.bpm.engine.CaseService
|
caseService
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseInstanceQuery caseInstanceQuery() {
return caseService().createCaseInstanceQuery();
}
|
Helper method to easily create a new CaseInstanceQuery.
@return new CaseInstanceQuery for process engine bound to this testing thread
|
caseInstanceQuery
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseExecutionQuery caseExecutionQuery() {
return caseService().createCaseExecutionQuery();
}
|
Helper method to easily create a new CaseExecutionQuery.
@return new CaseExecutionQuery for process engine bound to this testing thread
|
caseExecutionQuery
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseDefinitionQuery caseDefinitionQuery() {
return repositoryService().createCaseDefinitionQuery();
}
|
Helper method to easily create a new CaseDefinitionQuery.
@return new CaseExecutionQuery for process engine bound to this testing thread
|
caseDefinitionQuery
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static void complete(CaseExecution caseExecution) {
if (caseExecution == null) {
throw new IllegalArgumentException("Illegal call of complete(caseExecution) - must not be null!");
}
caseService().completeCaseExecution(caseExecution.getId());
}
|
Helper method to easily complete a CaseExecution.
@param caseExecution the CaseExecution to complete
|
complete
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static void disable(CaseExecution caseExecution) {
if (caseExecution == null) {
throw new IllegalArgumentException("Illegal call of disable(caseExecution) - must not be null!");
}
caseService().disableCaseExecution(caseExecution.getId());
}
|
Helper method to easily disable a case execution.
@param caseExecution
the case execution to complete
|
disable
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static void manuallyStart(CaseExecution caseExecution) {
if (caseExecution == null) {
throw new IllegalArgumentException("Illegal call of manuallyStart(caseExecution) - must not be null!");
}
caseService().manuallyStartCaseExecution(caseExecution.getId());
}
|
Helper method to manually start a case execution.
@param caseExecution
the case execution to start
|
manuallyStart
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseExecution caseExecution(String activityId, CaseInstance caseInstance) {
Assertions.assertThat(activityId).isNotNull();
return caseExecution(caseExecutionQuery().activityId(activityId), caseInstance);
}
|
Helper method to find any {@link CaseExecution} in the context of a CaseInstance.
@param activityId activity to find
@param caseInstance CaseInstance to search in
@return CaseExecution or null
|
caseExecution
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static CaseExecution caseExecution(CaseExecutionQuery caseExecutionQuery, CaseInstance caseInstance) {
return assertThat(caseInstance).isNotNull().descendantCaseExecution(caseExecutionQuery).getActual();
}
|
Helper method to find any {@link CaseExecution} in the context of a CaseInstance
@param caseExecutionQuery query for narrowing down on the CaseExecution to find
@param caseInstance CaseInstance to search in
@return CaseExecution or null
|
caseExecution
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
public static void complete(CaseExecution caseExecution, Map<String, Object> variables) {
if (caseExecution == null || variables == null) {
throw new IllegalArgumentException(format("Illegal call of complete(caseExecution = '%s', variables = '%s') - both must not be null!", caseExecution, variables));
}
caseService().completeCaseExecution(caseExecution.getId(), variables);
}
|
Helper method to easily complete a caseExecution and pass some
case variables.
@param caseExecution CaseExecution to be completed
@param variables Case variables to be passed to the
case instance when completing the caseExecution. For
setting those variables, you can use
{@link #withVariables(String, Object, Object...)}
|
complete
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/CmmnAwareTests.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isAvailable() {
return super.isAvailable();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'available'.
@return this {@link HumanTaskAssert}
|
isAvailable
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isEnabled() {
return super.isEnabled();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'enabled'.
@return this {@link HumanTaskAssert}
|
isEnabled
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isDisabled() {
return super.isDisabled();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'disabled'.
@return this {@link HumanTaskAssert}
|
isDisabled
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isActive() {
return super.isActive();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'active'.
@return this {@link HumanTaskAssert}
|
isActive
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isCompleted() {
return super.isCompleted();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'completed'.
@return this {@link HumanTaskAssert}
|
isCompleted
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public HumanTaskAssert isTerminated() {
return super.isTerminated();
}
|
Verifies the expectation that the {@link HumanTask} is in {@link CaseExecutionState} 'terminated'.
@return this {@link HumanTaskAssert}
|
isTerminated
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
public HumanTaskAssert hasNoVariables() {
return hasVars(null);
}
|
Verifies the expectation that the {@link HumanTask} holds no
case variables at all.
@return this {@link AbstractCaseAssert}
|
hasNoVariables
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
public HumanTaskAssert hasVariables(final String... names) {
return hasVars(names);
}
|
Verifies the expectation that the {@link HumanTask} holds one or
more case variables with the specified names.
@param names the names of the human task variables expected to exist. In
case no variable name is given, the existence of at least one
variable will be verified.
@return this {@link HumanTaskAssert}
|
hasVariables
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/HumanTaskAssert.java
|
Apache-2.0
|
@Override
public MilestoneAssert isAvailable() {
return super.isAvailable();
}
|
Verifies the expectation that the {@link CaseExecution} is 'available'.
@return this
|
isAvailable
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
Apache-2.0
|
@Override
public MilestoneAssert isCompleted() {
return super.isCompleted();
}
|
Verifies the expectation that the {@link CaseExecution} is 'completed'.
A milestone is 'completed', when his 'occur' transition was performed.
@return this
|
isCompleted
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
Apache-2.0
|
@Override
public MilestoneAssert isTerminated() {
return super.isTerminated();
}
|
Verifies the expectation that the {@link CaseExecution} is 'terminated'.
@return this
|
isTerminated
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/MilestoneAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isAvailable() {
return super.isAvailable();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'available'.
@return this {@link ProcessTaskAssert}
|
isAvailable
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isEnabled() {
return super.isEnabled();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'enabled'.
@return this {@link ProcessTaskAssert}
|
isEnabled
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isDisabled() {
return super.isDisabled();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'disabled'.
@return this {@link ProcessTaskAssert}
|
isDisabled
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isActive() {
return super.isActive();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'active'.
@return this {@link ProcessTaskAssert}
|
isActive
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isCompleted() {
return super.isCompleted();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'completed'.
@return this {@link ProcessTaskAssert}
|
isCompleted
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Override
public ProcessTaskAssert isTerminated() {
return super.isTerminated();
}
|
Verifies the expectation that the {@link ProcessTask} is in {@link CaseExecutionState} 'terminated'.
@return this {@link ProcessTaskAssert}
|
isTerminated
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
public ProcessTaskAssert hasNoVariables() {
return hasVars(null);
}
|
Verifies the expectation that the {@link ProcessTask} holds no
case variables at all.
@return this {@link AbstractCaseAssert}
|
hasNoVariables
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
public ProcessTaskAssert hasVariables(final String... names) {
return hasVars(names);
}
|
Verifies the expectation that the {@link ProcessTask} holds one or
more case variables with the specified names.
@param names the names of the human task variables expected to exist. In
case no variable name is given, the existence of at least one
variable will be verified.
@return this {@link ProcessTaskAssert}
|
hasVariables
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/main/java/org/camunda/bpm/engine/test/assertions/cmmn/ProcessTaskAssert.java
|
Apache-2.0
|
@Test
@Deployment(resources = { "cmmn/TaskTest.cmmn" })
/**
* Introduces:
* caseExecution(id, caseInstance)
* complete(caseExecution)
* caseInstance.isCompleted()
* task.isCompleted()
*/
public void case_should_complete_when_task_is_completed() {
// Given
CaseInstance caseInstance = givenCaseIsCreated();
// When
CaseExecution taskA;
complete(taskA = caseExecution(TASK_A, caseInstance));
// Then
assertThat(caseInstance).isCompleted();
assertThat(taskA).isCompleted();
}
|
Introduces:
assertThat(CaseInstance)
caseInstance.isActive()
caseInstance.activity(id)
task.isActive()
|
case_should_complete_when_task_is_completed
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/cmmn/TaskTest.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/cmmn/TaskTest.java
|
Apache-2.0
|
private CaseInstance givenCaseIsCreated() {
return caseService().createCaseInstanceByKey(CASE_KEY);
}
|
Introduces:
caseExecution(id, caseInstance)
complete(caseExecution)
caseInstance.isCompleted()
task.isCompleted()
|
givenCaseIsCreated
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/cmmn/TaskTest.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/cmmn/TaskTest.java
|
Apache-2.0
|
@Override
public CaseExecutionQuery answer(InvocationOnMock invocationOnMock) throws Throwable {
if (invocationOnMock.getMethod().getReturnType().isAssignableFrom(CaseExecutionQuery.class)) {
return (CaseExecutionQuery) invocationOnMock.getMock();
} else {
return null;
}
}
|
Default Answer for CaseExecutionQuery mocks that returns the mock as default answer.
Eases mocking of this class as most of its methods support the fluent API and therefore return the invoked instance.
|
answer
|
java
|
camunda/camunda-bpm-platform
|
test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/helpers/CaseExecutionQueryFluentAnswer.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/test-utils/assert/core/src/test/java/org/camunda/bpm/engine/test/assertions/helpers/CaseExecutionQueryFluentAnswer.java
|
Apache-2.0
|
public static AdminRuntimeDelegate getRuntimeDelegate() {
return ADMIN_RUNTIME_DELEGATE;
}
|
Returns an instance of {@link AdminRuntimeDelegate}
@return
|
getRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/admin/Admin.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/admin/Admin.java
|
Apache-2.0
|
public static void setAdminRuntimeDelegate(AdminRuntimeDelegate adminRuntimeDelegate) {
ADMIN_RUNTIME_DELEGATE = adminRuntimeDelegate;
}
|
A setter to set the {@link AdminRuntimeDelegate}.
@param adminRuntimeDelegate
|
setAdminRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/admin/Admin.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/admin/Admin.java
|
Apache-2.0
|
protected CommandExecutor createCommandExecutor(String processEngineName) {
ProcessEngine processEngine = getProcessEngine(processEngineName);
if (processEngine == null) {
throw new ProcessEngineException("No process engine with name " + processEngineName + " found.");
}
ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl) processEngine)
.getProcessEngineConfiguration();
return new CommandExecutorImpl(processEngineConfiguration, MAPPING_FILES);
}
|
Create command executor for the engine with the given name
@param processEngineName the process engine name
@return the command executor
|
createCommandExecutor
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/admin/impl/DefaultAdminRuntimeDelegate.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/admin/impl/DefaultAdminRuntimeDelegate.java
|
Apache-2.0
|
protected QueryService getQueryService() {
return Admin.getRuntimeDelegate().getQueryService(engineName);
}
|
Return a {@link QueryService} for the current
engine to execute queries against the engine database.
@return
|
getQueryService
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/admin/resource/AbstractAdminPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/admin/resource/AbstractAdminPluginResource.java
|
Apache-2.0
|
public static QueryService getQueryService(String processEngineName) {
return getRuntimeDelegate().getQueryService(processEngineName);
}
|
Returns a configured {@link QueryService} to execute custom
statements to the corresponding process engine
@param processEngineName
@return a {@link QueryService}
|
getQueryService
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
Apache-2.0
|
public static CockpitRuntimeDelegate getRuntimeDelegate() {
return COCKPIT_RUNTIME_DELEGATE;
}
|
Returns an instance of {@link CockpitRuntimeDelegate}
@return
|
getRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
Apache-2.0
|
public static void setCockpitRuntimeDelegate(CockpitRuntimeDelegate cockpitRuntimeDelegate) {
COCKPIT_RUNTIME_DELEGATE = cockpitRuntimeDelegate;
}
|
A setter to set the {@link CockpitRuntimeDelegate}.
@param cockpitRuntimeDelegate
|
setCockpitRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/Cockpit.java
|
Apache-2.0
|
protected List<String> getMappingFiles() {
List<CockpitPlugin> cockpitPlugins = pluginRegistry.getPlugins();
List<String> mappingFiles = new ArrayList<String>();
for (CockpitPlugin plugin: cockpitPlugins) {
mappingFiles.addAll(plugin.getMappingFiles());
}
return mappingFiles;
}
|
Returns the list of mapping files that should be used to create the
session factory for this runtime.
@return
|
getMappingFiles
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/impl/DefaultCockpitRuntimeDelegate.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/impl/DefaultCockpitRuntimeDelegate.java
|
Apache-2.0
|
protected CommandExecutor createCommandExecutor(String processEngineName) {
ProcessEngine processEngine = getProcessEngine(processEngineName);
if (processEngine == null) {
throw new ProcessEngineException("No process engine with name " + processEngineName + " found.");
}
ProcessEngineConfigurationImpl processEngineConfiguration = ((ProcessEngineImpl)processEngine).getProcessEngineConfiguration();
List<String> mappingFiles = getMappingFiles();
return new CommandExecutorImpl(processEngineConfiguration, mappingFiles);
}
|
Create command executor for the engine with the given name
@param processEngineName
@return
|
createCommandExecutor
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/impl/DefaultCockpitRuntimeDelegate.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/impl/DefaultCockpitRuntimeDelegate.java
|
Apache-2.0
|
protected boolean isAuthorizationEnabled() {
return getProcessEngine().getProcessEngineConfiguration().isAuthorizationEnabled();
}
|
Return <code>true</code> if authorization is enabled.
|
isAuthorizationEnabled
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
Apache-2.0
|
protected boolean isTenantCheckEnabled() {
return getProcessEngine().getProcessEngineConfiguration().isTenantCheckEnabled()
&& getCurrentAuthentication() != null
&& !isCamundaAdmin(getCurrentAuthentication());
}
|
Return <code>true</code> if tenant check is enabled.
|
isTenantCheckEnabled
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
Apache-2.0
|
protected boolean isCamundaAdmin(Authentication authentication) {
ProcessEngineConfigurationImpl engineConfiguration =
(ProcessEngineConfigurationImpl) getProcessEngine().getProcessEngineConfiguration();
List<String> groupIds = authentication.getGroupIds();
if (groupIds != null) {
List<String> adminGroups = engineConfiguration.getAdminGroups();
for (String adminGroup : adminGroups) {
if (groupIds.contains(adminGroup)) {
return true;
}
}
}
String userId = authentication.getUserId();
if (userId != null) {
List<String> adminUsers = engineConfiguration.getAdminUsers();
return adminUsers != null && adminUsers.contains(userId);
}
return false;
}
|
Return <code>true</code> if the given authentication is part of the admin groups or admin users
|
isCamundaAdmin
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
Apache-2.0
|
protected void configureAuthorizationCheck(QueryParameters query) {
Authentication currentAuthentication = getCurrentAuthentication();
AuthorizationCheck authCheck = query.getAuthCheck();
authCheck.getPermissionChecks().clear();
if (isAuthorizationEnabled() && currentAuthentication != null) {
authCheck.setAuthorizationCheckEnabled(true);
String currentUserId = currentAuthentication.getUserId();
List<String> currentGroupIds = currentAuthentication.getGroupIds();
authCheck.setAuthUserId(currentUserId);
authCheck.setAuthGroupIds(currentGroupIds);
}
}
|
Configure the authorization check for the given {@link QueryParameters}.
|
configureAuthorizationCheck
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
Apache-2.0
|
protected void configureTenantCheck(QueryParameters query) {
TenantCheck tenantCheck = query.getTenantCheck();
if (isTenantCheckEnabled()) {
Authentication currentAuthentication = getCurrentAuthentication();
tenantCheck.setTenantCheckEnabled(true);
tenantCheck.setAuthTenantIds(currentAuthentication.getTenantIds());
} else {
tenantCheck.setTenantCheckEnabled(false);
tenantCheck.setAuthTenantIds(null);
}
}
|
Configure the tenant check for the given {@link QueryParameters}.
|
configureTenantCheck
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/resource/AbstractCockpitPluginResource.java
|
Apache-2.0
|
public List<String> getMappingFiles() {
return Collections.emptyList();
}
|
An implementation of {@link CockpitPlugin} that comes with reasonable defaults.
@author nico.rehwaldt
@see CockpitPlugin
|
getMappingFiles
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/spi/impl/AbstractCockpitPlugin.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/plugin/spi/impl/AbstractCockpitPlugin.java
|
Apache-2.0
|
protected ProcessEngine getProcessEngine() {
return Cockpit.getProcessEngine(engineName);
}
|
Return a {@link ProcessEngine} for the current
engine name to execute queries against the engine.
@return the process engine
|
getProcessEngine
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/cockpit/service/AbstractEngineAware.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/cockpit/service/AbstractEngineAware.java
|
Apache-2.0
|
public static TasklistRuntimeDelegate getRuntimeDelegate() {
return TASKLIST_RUNTIME_DELEGATE;
}
|
Returns an instance of {@link TasklistRuntimeDelegate}
@return
|
getRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/tasklist/Tasklist.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/tasklist/Tasklist.java
|
Apache-2.0
|
public static void setTasklistRuntimeDelegate(TasklistRuntimeDelegate tasklistRuntimeDelegate) {
TASKLIST_RUNTIME_DELEGATE = tasklistRuntimeDelegate;
}
|
A setter to set the {@link TasklistRuntimeDelegate}.
@param tasklistRuntimeDelegate
|
setTasklistRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/tasklist/Tasklist.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/tasklist/Tasklist.java
|
Apache-2.0
|
@Override
public Set<Class<?>> getClasses() {
Set<Class<?>> classes = new HashSet<Class<?>>();
// only provide named process engine access.
classes.add(NamedProcessEngineRestServiceImpl.class);
// mandatory
classes.addAll(CamundaRestResources.getConfigurationClasses());
return classes;
}
|
The engine rest api exposed by the application.
@author nico.rehwaldt
|
getClasses
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/engine/EngineRestApplication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/engine/EngineRestApplication.java
|
Apache-2.0
|
protected boolean hasWebResource(String name) {
try {
URL resource = filterConfig.getServletContext().getResource(name);
return resource != null;
} catch (MalformedURLException e) {
return false;
}
}
|
Returns true if the given web resource exists.
@param name
@return
|
hasWebResource
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/filter/AbstractTemplateFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/filter/AbstractTemplateFilter.java
|
Apache-2.0
|
protected String getWebResourceContents(String name) throws IOException {
InputStream is = null;
try {
is = filterConfig.getServletContext().getResourceAsStream(name);
BufferedReader reader = new BufferedReader(new InputStreamReader(is));
StringWriter writer = new StringWriter();
String line = null;
while ((line = reader.readLine()) != null) {
writer.write(line);
writer.append("\n");
}
return writer.toString();
} finally {
if (is != null) {
try { is.close(); } catch (IOException e) { }
}
}
}
|
Returns the string contents of a web resource with the given name.
The resource must be static and text based.
@param name the name of the resource
@return the resource contents
@throws IOException
|
getWebResourceContents
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/filter/AbstractTemplateFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/filter/AbstractTemplateFilter.java
|
Apache-2.0
|
public String getName() {
return identityId;
}
|
java.security.Principal implementation: return the id of the identity
(userId) behind this authentication
|
getName
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentication.java
|
Apache-2.0
|
public String getIdentityId() {
return identityId;
}
|
@return the id of the identity
(userId) behind this authentication
|
getIdentityId
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentication.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentication.java
|
Apache-2.0
|
public Authentication getAuthenticationForProcessEngine(String engineName) {
return authentications.get(engineName);
}
|
Returns an {@link Authentication} for a provided process engine name or "null".
@param engineName the name of the process engine for which the userId should be
retrieved.
@return {@link Authentication} for the provided process engine or
"null" if no user is authenticated for this process engine.
|
getAuthenticationForProcessEngine
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public void addOrReplace(UserAuthentication authentication) {
authentications.put(authentication.getProcessEngineName(), authentication);
}
|
Adds an authentication to the list of current authentications. If there already
exists an authentication of the same process engine, it is replaced silently.
@param authentication the authentication to add
|
addOrReplace
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public UserAuthentication removeByEngineName(String engineName) {
return authentications.remove(engineName);
}
|
Removes the authentication for the provided process engine name.
@param engineName the name of the process engine for which the authentication should
be removed.
@return the removed user authentication
|
removeByEngineName
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public List<UserAuthentication> getAuthentications() {
return new ArrayList<>(authentications.values());
}
|
@return all active {@link Authentication Authentications}.
|
getAuthentications
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public boolean hasAuthenticationForProcessEngine(String engineName) {
return getAuthenticationForProcessEngine(engineName) != null;
}
|
Allows checking whether a user is currently authenticated for a given process engine name.
@param engineName the name of the process engine for which we want to check for authentication.
@return true if a user is authenticated for the provided process engine name.
|
hasAuthenticationForProcessEngine
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public static Authentications getCurrent() {
return currentAuthentications.get();
}
|
Returns the authentications for the current thread.
@return the authentications.
|
getCurrent
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/Authentications.java
|
Apache-2.0
|
public static Authentications getAuthsFromSession(HttpSession session) {
Authentications authentications = (Authentications) session.getAttribute(CAM_AUTH_SESSION_KEY);
if (authentications == null) {
authentications = new Authentications();
session.setAttribute(CAM_AUTH_SESSION_KEY, authentications);
}
return authentications;
}
|
Allows obtaining an {@link Authentications} object from the
{@link HttpSession}. If no such object exists in the session, a new
instance is created and returned.
@param session the {@link HttpSession} instance from which to retrieve the
{@link Authentications}.
|
getAuthsFromSession
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
Apache-2.0
|
public static void revalidateSession(HttpServletRequest request, UserAuthentication authentication) {
HttpSession session = request.getSession();
Authentications authentications = getAuthsFromSession(session);
// invalidate old & create new session
session.invalidate();
session = request.getSession(true);
if (authentication != null) {
authentications.addOrReplace(authentication);
session.setAttribute(CAM_AUTH_SESSION_KEY, authentications);
}
}
|
Invalidates the old {@link HttpSession} of the current request and creates
a new one. Additionally, transfers the existing authentications to the new
session and adds a new one.
@param request the {@link HttpServletRequest} instance from which the session
is obtained and a new {@link HttpSession} created.
@param authentication the new {@link Authentication} instance that is created
through user login. It is added to the existing authentications.
|
revalidateSession
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
Apache-2.0
|
public static void updateCache(Authentications authentications,
HttpSession session,
long cacheTimeToLive) {
synchronized (getSessionMutex(session)) {
for (UserAuthentication authentication : authentications.getAuthentications()) {
Date cacheValidationTime = authentication.getCacheValidationTime();
if (cacheValidationTime == null ||
ClockUtil.getCurrentTime().after(cacheValidationTime)) {
String userId = authentication.getIdentityId();
String engineName = authentication.getProcessEngineName();
UserAuthentication updatedAuth = createAuthentication(engineName, userId);
if (updatedAuth != null) {
if (cacheTimeToLive > 0) {
Date newCacheValidationTime = new Date(ClockUtil.getCurrentTime().getTime() + cacheTimeToLive);
updatedAuth.setCacheValidationTime(newCacheValidationTime);
LOGGER.traceCacheValidationTimeUpdated(cacheValidationTime, newCacheValidationTime);
}
LOGGER.traceAuthenticationUpdated(engineName);
authentications.addOrReplace(updatedAuth);
} else {
authentications.removeByEngineName(engineName);
LOGGER.traceAuthenticationRemoved(engineName);
}
}
}
}
}
|
<p>Update/remove authentications when cache validation time (= x + TTL) is due.
<p>The following information is updated:<ul>
<li>{@code groupIds}
<li>{@code tenantIds}
<li>{@code authorizedApps}
<p>An authorization is only removed if the user doesn't exist anymore (user was deleted).
|
updateCache
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
Apache-2.0
|
protected static Object getSessionMutex(HttpSession session) {
Object mutex = session.getAttribute(AUTH_TIME_SESSION_MUTEX);
if (mutex == null) {
mutex = session; // synchronize on session if session mutex doesn't exist
}
return mutex;
}
|
<p>Returns the session mutex to synchronize on.
<p>Avoids updating the auth cache by multiple HTTP requests in parallel.
|
getSessionMutex
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/auth/AuthenticationUtil.java
|
Apache-2.0
|
protected boolean doTokenValidation(HttpServletRequest request, HttpServletResponse response) throws IOException {
HttpSession session = request.getSession();
String tokenHeader = getCSRFTokenHeader(request);
String tokenSession = (String) getCSRFTokenSession(session);
boolean isValid = true;
if (isBlank(tokenHeader)) {
session.invalidate();
response.setHeader(CsrfConstants.CSRF_TOKEN_HEADER_NAME, CsrfConstants.CSRF_TOKEN_HEADER_REQUIRED);
response.sendError(getDenyStatus(), "CSRFPreventionFilter: Token provided via HTTP Header is absent/empty.");
isValid = false;
} else if (isBlank(tokenSession) || !tokenSession.equals(tokenHeader)) {
session.invalidate();
response.sendError(getDenyStatus(), "CSRFPreventionFilter: Invalid HTTP Header Token.");
isValid = false;
}
return isValid;
}
|
Validates the provided CSRF token value from
the request with the session CSRF token value.
@param request
@param response
@return true if the token is valid
@throws IOException
|
doTokenValidation
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
Apache-2.0
|
protected boolean doSameOriginStandardHeadersVerification(HttpServletRequest request, HttpServletResponse response) throws IOException {
// if target origin is not set, skip Same Origin with Standard Headers Verification
if (getTargetOrigin() == null) {
return true;
}
String source = request.getHeader("Origin");
if (this.isBlank(source)) {
//If empty then fallback on "Referer" header
source = request.getHeader("Referer");
//If this one is empty too, an error is reported
if (this.isBlank(source)) {
response.sendError(HttpServletResponse.SC_FORBIDDEN, "CSRFPreventionFilter: ORIGIN and REFERER request headers are not present.");
return false;
}
}
//Compare the source against the expected target origin
URL sourceURL = new URL(source);
if (!getTargetOrigin().getProtocol().equals(sourceURL.getProtocol())
|| !getTargetOrigin().getHost().equals(sourceURL.getHost())
|| getTargetOrigin().getPort() != sourceURL.getPort()) {
//If any part of the URL doesn't match, an error is reported
response.sendError(HttpServletResponse.SC_FORBIDDEN, String.format("CSRFPreventionFilter: Protocol/Host/Port does not fully match: (%s != %s) ", getTargetOrigin(), sourceURL));
return false;
}
return true;
}
|
Validates if the Origin/Referer header matches the provided target origin.
@param request
@param response
@return true if the values match
@throws IOException
|
doSameOriginStandardHeadersVerification
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
Apache-2.0
|
public void setTargetOrigin(String targetOrigin) throws MalformedURLException {
this.targetOrigin = new URL(targetOrigin);
}
|
Target origin is the application expected deployment domain, i.e. the domain
name through which the webapps are accessed. If nothing is set, the "Same Origin
with Standard Headers" verification is not performed.
@param targetOrigin The application's domain name together with the protocol
and port (ex. http://example.com:8080)
@throws MalformedURLException
|
setTargetOrigin
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
Apache-2.0
|
public int getDenyStatus() {
return denyStatus;
}
|
@return the response status code that is used to reject a denied request.
|
getDenyStatus
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
Apache-2.0
|
protected boolean isNonModifyingRequest(HttpServletRequest request) {
return CsrfConstants.CSRF_NON_MODIFYING_METHODS_PATTERN.matcher(request.getMethod()).matches()
|| entryPoints.contains(getRequestedPath(request));
}
|
Determine if the request a non-modifying request. A non-modifying
request is one that is either a 'HTTP GET/OPTIONS/HEAD' request, or
is allowed explicitly through the 'entryPoints' parameter in the web.xml
@return true if the request is a non-modifying request
|
isNonModifyingRequest
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/CsrfPreventionFilter.java
|
Apache-2.0
|
@Override
public Authorization authorize(Map<String, String> parameters) {
Authentications authentications = Authentications.getCurrent();
if (authentications == null) {
// no authentications --> reject request to app
return Authorization.denied(Authentication.ANONYMOUS);
} else {
String engineName = parameters.get("engine");
Authentication engineAuth = authentications.getAuthenticationForProcessEngine(engineName);
return Authorization.grantedUnlessNull(engineAuth);
}
}
|
<p>This is a {@link RequestAuthorizer} which authorizes all process engine api
requests based on the current authentication</p>
@author Daniel Meyer
@author nico.rehwaldt
|
authorize
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/EngineRequestAuthorizer.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/EngineRequestAuthorizer.java
|
Apache-2.0
|
@Override
public Authorization authorize(Map<String, String> parameters) {
return Authorization.granted(Authentication.ANONYMOUS);
}
|
Authorize a request with the given parameters by returning a valid {@link Authentication}.
@param parameters
@return a valid {@link Authentication} or <code>null</code> if authorization to this request
has not been granted
|
authorize
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/RequestAuthorizer.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/RequestAuthorizer.java
|
Apache-2.0
|
protected final void setPattern(String pattern, String applicationPath) {
String[] parts = pattern.split("/");
ArrayList<String> groupList = new ArrayList<String>();
StringBuilder regexBuilder = new StringBuilder();
if (!applicationPath.isEmpty()) {
regexBuilder.append(applicationPath);
}
boolean first = true;
for (String part: parts) {
String group = null;
String regex = part;
// parse group
if (part.startsWith("{") && part.endsWith("}")) {
String groupStr = part.substring(1, part.length() - 1);
String[] groupSplit = groupStr.split(":");
if (groupSplit.length > 2) {
throw new IllegalArgumentException("cannot parse uri part " + regex + " in " + pattern + ": expected {asdf(:pattern)}");
}
group = groupSplit[0];
if (groupSplit.length > 1) {
regex = "(" + groupSplit[1] + ")";
} else {
regex = "([^/]+)";
}
}
if (!first) {
regexBuilder.append("/");
} else {
first = false;
}
regexBuilder.append(regex);
if (group != null) {
groupList.add(group);
}
}
this.groups = groupList.toArray(new String[0]);
this.pattern = Pattern.compile(regexBuilder.toString());
}
|
Sets the uri pattern for this matcher
@param pattern
|
setPattern
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/RequestFilter.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/RequestFilter.java
|
Apache-2.0
|
public static Authorization authorize(String requestMethod, String requestUri, List<SecurityFilterRule> filterRules) {
Authorization authorization;
for (SecurityFilterRule filterRule : filterRules) {
authorization = filterRule.authorize(requestMethod, requestUri);
if (authorization != null) {
return authorization;
}
}
// grant if no filter disallows it
return Authorization.granted(Authentication.ANONYMOUS);
}
|
Iterate over a number of filter rules and match them against
the given request.
@param requestMethod
@param requestUri
@param filterRules
@return the checked request with authorization information attached
|
authorize
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/util/FilterRules.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/security/filter/util/FilterRules.java
|
Apache-2.0
|
public static String getAppPath(ServletContext servletContext) {
String applicationPath = (String) servletContext.getAttribute(APP_PATH_ATTR_NAME);
if (applicationPath == null) {
return "";
} else {
return applicationPath;
}
}
|
Consumed by Camunda Platform CE & EE Webapp:
Retrieves the application path from Spring Boot's servlet context.
@param servletContext that holds the application path
@return a non-empty <code>String</code> containing the application path or an empty
<code>String</code> when no application path was set.
|
getAppPath
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
Apache-2.0
|
public static void setAppPath(String applicationPath, ServletContext servletContext) {
servletContext.setAttribute(APP_PATH_ATTR_NAME, applicationPath);
}
|
Sets an application path into Spring Boot's servlet context.
@param applicationPath to be set into Spring Boot's servlet context
@param servletContext of Spring Boot the application path should be set into
|
setAppPath
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
Apache-2.0
|
public static boolean isTelemetryDataSentAlready(String webappName, String engineName, ServletContext servletContext) {
return servletContext.getAttribute(buildTelemetrySentAttribute(webappName, engineName)) != null;
}
|
@return whether the web application has already successfully been sent to
the engine as telemetry info or not.
|
isTelemetryDataSentAlready
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
Apache-2.0
|
public static void setCacheTTLForLogin(long cacheTimeToLive, ServletContext servletContext) {
servletContext.setAttribute(AUTH_CACHE_TTL_ATTR_NAME, cacheTimeToLive);
}
|
Sets {@param cacheTimeToLive} in the {@link AuthenticationFilter} to be used on initial login authentication.
See {@link AuthenticationFilter#doFilter(ServletRequest, ServletResponse, FilterChain)}
|
setCacheTTLForLogin
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
Apache-2.0
|
public static Date getAuthCacheValidationTime(ServletContext servletContext) {
Long cacheTimeToLive = (Long) servletContext.getAttribute(AUTH_CACHE_TTL_ATTR_NAME);
if (cacheTimeToLive != null) {
return new Date(ClockUtil.getCurrentTime().getTime() + cacheTimeToLive);
} else {
return null;
}
}
|
Returns {@code authCacheValidationTime} from servlet context to be used on initial login authentication.
See {@link UserAuthenticationResource#doLogin(String, String, String, String)}
|
getAuthCacheValidationTime
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletContextUtil.java
|
Apache-2.0
|
public static boolean isEmpty(String string) {
return string == null || string.trim().isEmpty();
}
|
Checks if servlet filter init parameter is empty.
|
isEmpty
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletFilterUtil.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/impl/util/ServletFilterUtil.java
|
Apache-2.0
|
protected ProcessEngine getProcessEngine() {
return runtimeDelegate.getProcessEngine(engineName);
}
|
A abstract plugin resource class that may be used to implement
REST resources which are added to the REST application of the app.
@author nico.rehwaldt
@author Daniel Meyer
|
getProcessEngine
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginResource.java
|
Apache-2.0
|
protected List<String> getAllowedAssets() {
List<String> assets = new ArrayList<>();
assets.add("app/plugin.js");
assets.add("app/plugin.css");
return assets;
}
|
<p>Returns the list of allowed assets to be served by the {@link #getAsset(String)} method.</p>
<p>The default implementation includes: <code>["app/plugin.js","app/plugin.css"]</code></p>
@return list of allowed assets
|
getAllowedAssets
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginRootResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginRootResource.java
|
Apache-2.0
|
protected <S extends AbstractAppPluginResource<T>> S subResource(S subResource, String engineName) {
return subResource;
}
|
@param <T>
@param subResource
@param engineName
@return
|
subResource
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginRootResource.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/webapp/plugin/resource/AbstractAppPluginRootResource.java
|
Apache-2.0
|
public static WelcomeRuntimeDelegate getRuntimeDelegate() {
return WELCOME_RUNTIME_DELEGATE;
}
|
Returns an instance of {@link WelcomeRuntimeDelegate}
@return
|
getRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/welcome/Welcome.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/welcome/Welcome.java
|
Apache-2.0
|
public static void setRuntimeDelegate(WelcomeRuntimeDelegate welcomeRuntimeDelegate) {
WELCOME_RUNTIME_DELEGATE = welcomeRuntimeDelegate;
}
|
A setter to set the {@link WelcomeRuntimeDelegate}.
@param cockpitRuntimeDelegate
|
setRuntimeDelegate
|
java
|
camunda/camunda-bpm-platform
|
webapps/assembly/src/main/java/org/camunda/bpm/welcome/Welcome.java
|
https://github.com/camunda/camunda-bpm-platform/blob/master/webapps/assembly/src/main/java/org/camunda/bpm/welcome/Welcome.java
|
Apache-2.0
|
public static double computeTargetQui(boolean implicit, double value, double currentValue) {
// We want Qui to change based on value. What's the target value, Qui'?
if (implicit) {
// Target is really 1, or 0, depending on whether value is positive or negative.
// This wouldn't account for the strength though. Instead the target is a function
// of the current value and strength. If the current value is c, and value is positive
// then the target is somewhere between c and 1 depending on the strength. If current
// value is already >= 1, there's no effect. Similarly for negative values.
if (value > 0.0f && currentValue < 1.0) {
double diff = 1.0 - Math.max(0.0, currentValue);
return currentValue + (value / (1.0 + value)) * diff;
}
if (value < 0.0f && currentValue > 0.0) {
double diff = -Math.min(1.0, currentValue);
return currentValue + (value / (value - 1.0)) * diff;
}
// No change
return Double.NaN;
} else {
// Non-implicit -- value is supposed to be the new value
return value;
}
}
|
Computes how the estimated strength of interaction in the model should change -- to what target
value -- in response to a new interaction.
@param implicit whether the model is implicit feedback
@param value new interaction's strength
@param currentValue existing estimated of strength of interaction
@return new target estimated of strength of interaction, or NaN to signal "no change needed"
|
computeTargetQui
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/ALSUtils.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/ALSUtils.java
|
Apache-2.0
|
public static float[] computeUpdatedXu(Solver solver,
double value,
float[] Xu,
float[] Yi,
boolean implicit) {
if (Yi == null) {
return null;
}
boolean noXu = Xu == null;
double Qui = noXu ? 0.0 : VectorMath.dot(Xu, Yi);
// Qui' is the target, new value of Qui
// 0.5 reflects a "don't know" state
double targetQui = computeTargetQui(implicit, value, noXu ? 0.5 : Qui);
if (Double.isNaN(targetQui)) {
return null;
}
double dQui = targetQui - Qui;
double[] dQuiYi = new double[Yi.length];
for (int i = 0; i < dQuiYi.length; i++) {
dQuiYi[i] = Yi[i] * dQui;
}
double[] dXu = solver.solveDToD(dQuiYi);
float[] newXu = noXu ? new float[dXu.length] : Xu.clone();
for (int i = 0; i < newXu.length; i++) {
newXu[i] += dXu[i];
}
return newXu;
}
|
Computes how a user vector Xu changes in response to interaction with an item vector Yi.
This can also be used to compute how an item vector changes in response to a user interaction,
even though the code naming follows the former convention.
@param solver solver helping solve for Xu in Qu*Y = Xu * (Yt * Y)
@param value strength of interaction
@param Xu current user vector (null if no existing user vector)
@param Yi current item vector
@param implicit whether the model is implicit feedback
@return new user vector Xu, or {@code null} if no update should be made (i.e. there was no
item vector; the update would push the new Qui farther out of range)
|
computeUpdatedXu
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/ALSUtils.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/ALSUtils.java
|
Apache-2.0
|
public void compute() {
// Make sure only one attempts to build at one time
if (solverUpdating.compareAndSet(false, true)) {
executor.execute(LoggingCallable.log(() -> {
try {
log.info("Computing cached solver");
// Not as much hurry if one already exists
boolean lowPriority = solver.get() != null;
Solver newYTYSolver = LinearSystemSolver.getSolver(vectorPartitions.getVTV(lowPriority));
if (newYTYSolver != null) {
log.info("Computed new solver {}", newYTYSolver);
solver.set(newYTYSolver);
}
} finally {
// Allow any threads waiting for initial model to proceed.
// It's possible the solver is still null here if there is no input.
solverInitialized.countDown();
solverUpdating.set(false);
}
}).asRunnable());
}
}
|
Proactively try to compute the solver asynchronously, if not already computed.
Does not block.
|
compute
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/SolverCache.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/SolverCache.java
|
Apache-2.0
|
public Solver get(boolean blocking) {
if (solverDirty.getAndSet(false)) {
// launch asynchronous update
compute();
}
// Wait, in the case that there is no existing model already.
// Otherwise this immediately proceeds.
if (blocking && solverInitialized.getCount() > 0) { // Always 0 or 1
// OK if countDown() happens here; await() will return immediately
try {
solverInitialized.await();
} catch (InterruptedException e) {
log.warn("Interrupted while waiting for model", e);
}
}
return solver.get();
}
|
@param blocking whether to block waiting for a first model
@return a recent {@link Solver}, optionally blocking if necessary to wait for an initial one to
be computed. It does not block otherwise and returns the most recently computed one.
Note that this method may return {@code null} even when blocking , for instance,
if no solver is computable because there is no data.
|
get
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/SolverCache.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/als/SolverCache.java
|
Apache-2.0
|
public static CategoricalFeature forEncoding(int encoding) {
Preconditions.checkArgument(encoding >= 0);
// Not important if several threads get here
return FEATURE_CACHE.computeIfAbsent(encoding, k -> new CategoricalFeature(encoding));
}
|
@param encoding category value ID to create {@code CategoricalFeature} for
@return {@code CategoricalFeature} representing the category value specified by ID
|
forEncoding
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/CategoricalFeature.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/CategoricalFeature.java
|
Apache-2.0
|
public int getEncoding() {
return encoding;
}
|
@return category value ID represented by this {@code CategoricalFeature}
|
getEncoding
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/CategoricalFeature.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/CategoricalFeature.java
|
Apache-2.0
|
public static Example dataToExample(String[] data,
InputSchema inputSchema,
CategoricalValueEncodings valueEncodings) {
try {
Feature[] features = new Feature[data.length];
Feature target = null;
for (int featureIndex = 0; featureIndex < data.length; featureIndex++) {
Feature feature;
String dataAtIndex = data[featureIndex];
boolean isTarget = inputSchema.isTarget(featureIndex);
if (isTarget && dataAtIndex.isEmpty()) {
feature = null;
} else if (inputSchema.isNumeric(featureIndex)) {
feature = NumericFeature.forValue(Double.parseDouble(dataAtIndex));
} else if (inputSchema.isCategorical(featureIndex)) {
int encoding = valueEncodings.getValueEncodingMap(featureIndex).get(dataAtIndex);
feature = CategoricalFeature.forEncoding(encoding);
} else {
feature = null;
}
if (isTarget) {
target = feature;
} else {
features[featureIndex] = feature;
}
}
return new Example(target, features);
} catch (NumberFormatException | ArrayIndexOutOfBoundsException e) {
log.warn("Bad input: {}", Arrays.toString(data));
throw e;
}
}
|
@param data tokenized string data
@param inputSchema schema to apply to input
@param valueEncodings categorical value encodings
@return parsed {@link Example}
|
dataToExample
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/ExampleUtils.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/ExampleUtils.java
|
Apache-2.0
|
public static NumericFeature forValue(double value) {
return value == 0.0f ? ZERO : new NumericFeature(value);
}
|
@param value value to represent as a feature
@return {@code NumericFeature} representing the given numeric value
|
forValue
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/NumericFeature.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/classreg/example/NumericFeature.java
|
Apache-2.0
|
@Override
public double applyAsDouble(double[] t1, double[] t2) {
int length = t1.length;
Preconditions.checkArgument(length == t2.length);
double sumSq = 0.0;
for (int i = 0; i < length; i++) {
double diff = t1[i] - t2[i];
sumSq += diff * diff;
}
return Math.sqrt(sumSq);
}
|
Returns the Euclidean distance between two {@code double[]}.
|
applyAsDouble
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/EuclideanDistanceFn.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/EuclideanDistanceFn.java
|
Apache-2.0
|
public static void validatePMMLVsSchema(PMML pmml, InputSchema schema) {
List<Model> models = pmml.getModels();
Preconditions.checkArgument(models.size() == 1,
"Should have exactly one model, but had %s", models.size());
Model model = models.get(0);
Preconditions.checkArgument(model instanceof ClusteringModel);
Preconditions.checkArgument(model.getMiningFunction() == MiningFunction.CLUSTERING);
DataDictionary dictionary = pmml.getDataDictionary();
Preconditions.checkArgument(
schema.getFeatureNames().equals(AppPMMLUtils.getFeatureNames(dictionary)),
"Feature names in schema don't match names in PMML");
MiningSchema miningSchema = model.getMiningSchema();
Preconditions.checkArgument(schema.getFeatureNames().equals(
AppPMMLUtils.getFeatureNames(miningSchema)));
}
|
Validates that the encoded PMML model received matches expected schema.
@param pmml {@link PMML} encoding of KMeans Clustering
@param schema expected schema attributes of KMeans Clustering
|
validatePMMLVsSchema
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/KMeansPMMLUtils.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/KMeansPMMLUtils.java
|
Apache-2.0
|
public static List<ClusterInfo> read(PMML pmml) {
Model model = pmml.getModels().get(0);
Preconditions.checkArgument(model instanceof ClusteringModel);
ClusteringModel clusteringModel = (ClusteringModel) model;
return clusteringModel.getClusters().stream().map(cluster ->
new ClusterInfo(Integer.parseInt(cluster.getId()),
VectorMath.parseVector(
TextUtils.parseDelimited(cluster.getArray().getValue().toString(), ' ')),
cluster.getSize())
).collect(Collectors.toList());
}
|
@param pmml PMML representation of Clusters
@return List of {@link ClusterInfo}
|
read
|
java
|
OryxProject/oryx
|
app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/KMeansPMMLUtils.java
|
https://github.com/OryxProject/oryx/blob/master/app/oryx-app-common/src/main/java/com/cloudera/oryx/app/kmeans/KMeansPMMLUtils.java
|
Apache-2.0
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.