io.vertigo.orchestra.dao.definition.OActivityDAO Maven / Gradle / Ivy
The newest version!
/*
* vertigo - application development platform
*
* Copyright (C) 2013-2024, Vertigo.io, [email protected]
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.vertigo.orchestra.dao.definition;
import java.util.Optional;
import javax.inject.Inject;
import io.vertigo.core.lang.Generated;
import io.vertigo.core.node.Node;
import io.vertigo.datamodel.smarttype.SmartTypeManager;
import io.vertigo.datamodel.task.TaskManager;
import io.vertigo.datamodel.task.definitions.TaskDefinition;
import io.vertigo.datamodel.task.model.Task;
import io.vertigo.datamodel.task.model.TaskBuilder;
import io.vertigo.datastore.entitystore.EntityStoreManager;
import io.vertigo.datastore.impl.dao.DAO;
import io.vertigo.datastore.impl.dao.StoreServices;
import io.vertigo.orchestra.domain.definition.OActivity;
/**
* This class is automatically generated.
* DO NOT EDIT THIS FILE DIRECTLY.
*/
@Generated
public final class OActivityDAO extends DAO implements StoreServices {
/**
* Contructeur.
* @param entityStoreManager Manager de persistance
* @param taskManager Manager de Task
* @param smartTypeManager SmartTypeManager
*/
@Inject
public OActivityDAO(final EntityStoreManager entityStoreManager, final TaskManager taskManager, final SmartTypeManager smartTypeManager) {
super(OActivity.class, entityStoreManager, taskManager, smartTypeManager);
}
/**
* Creates a taskBuilder.
* @param name the name of the task
* @return the builder
*/
private static TaskBuilder createTaskBuilder(final String name) {
final TaskDefinition taskDefinition = Node.getNode().getDefinitionSpace().resolve(name, TaskDefinition.class);
return Task.builder(taskDefinition);
}
/**
* Execute la tache TkGetActivitiesByProId.
* @param proId Long
* @return DtList de OActivity dtOActivities
*/
@io.vertigo.datamodel.task.proxy.TaskAnnotation(
dataSpace = "orchestra",
name = "TkGetActivitiesByProId",
request = "select act.* \n" +
" from O_ACTIVITY act \n" +
" where act.PRO_ID = #proId#",
taskEngineClass = io.vertigo.basics.task.TaskEngineSelect.class)
@io.vertigo.datamodel.task.proxy.TaskOutput(smartType = "STyDtOActivity", name = "dtOActivities")
public io.vertigo.datamodel.data.model.DtList getActivitiesByProId(@io.vertigo.datamodel.task.proxy.TaskInput(name = "proId", smartType = "STyOIdentifiant") final Long proId) {
final Task task = createTaskBuilder("TkGetActivitiesByProId")
.addValue("proId", proId)
.addContextProperty("connectionName", io.vertigo.datastore.impl.dao.StoreUtil.getConnectionName("orchestra"))
.build();
return getTaskManager()
.execute(task)
.getResult();
}
/**
* Execute la tache TkGetAllActivitiesInActiveProcesses.
* @return DtList de OActivity dtOActivities
*/
@io.vertigo.datamodel.task.proxy.TaskAnnotation(
dataSpace = "orchestra",
name = "TkGetAllActivitiesInActiveProcesses",
request = "select act.* \n" +
" from O_ACTIVITY act \n" +
" join O_PROCESS pro on pro.PRO_ID = act.PRO_ID\n" +
" where pro.ACTIVE_VERSION is true",
taskEngineClass = io.vertigo.basics.task.TaskEngineSelect.class)
@io.vertigo.datamodel.task.proxy.TaskOutput(smartType = "STyDtOActivity", name = "dtOActivities")
public io.vertigo.datamodel.data.model.DtList getAllActivitiesInActiveProcesses() {
final Task task = createTaskBuilder("TkGetAllActivitiesInActiveProcesses")
.addContextProperty("connectionName", io.vertigo.datastore.impl.dao.StoreUtil.getConnectionName("orchestra"))
.build();
return getTaskManager()
.execute(task)
.getResult();
}
/**
* Execute la tache TkGetFirstActivityByProcess.
* @param proId Long
* @return OActivity dtOActivity
*/
@io.vertigo.datamodel.task.proxy.TaskAnnotation(
dataSpace = "orchestra",
name = "TkGetFirstActivityByProcess",
request = "select act.* \n" +
" from O_ACTIVITY act \n" +
" inner join(\n" +
" select activity.PRO_ID as PRO_ID,\n" +
" min(activity.NUMBER) as NUMBER_MIN\n" +
" from O_ACTIVITY activity\n" +
" \n" +
" where activity.PRO_ID = #proId#\n" +
" group by activity.PRO_ID\n" +
" ) actMin on (act.PRO_ID = actMin.PRO_ID and act.NUMBER = actMin.NUMBER_MIN)\n" +
" where 1=1",
taskEngineClass = io.vertigo.basics.task.TaskEngineSelect.class)
@io.vertigo.datamodel.task.proxy.TaskOutput(smartType = "STyDtOActivity", name = "dtOActivity")
public io.vertigo.orchestra.domain.definition.OActivity getFirstActivityByProcess(@io.vertigo.datamodel.task.proxy.TaskInput(name = "proId", smartType = "STyOIdentifiant") final Long proId) {
final Task task = createTaskBuilder("TkGetFirstActivityByProcess")
.addValue("proId", proId)
.addContextProperty("connectionName", io.vertigo.datastore.impl.dao.StoreUtil.getConnectionName("orchestra"))
.build();
return getTaskManager()
.execute(task)
.getResult();
}
/**
* Execute la tache TkGetNextActivityByActId.
* @param actId Long
* @return Option de OActivity dtOActivity
*/
@io.vertigo.datamodel.task.proxy.TaskAnnotation(
dataSpace = "orchestra",
name = "TkGetNextActivityByActId",
request = "select act.* \n" +
" from O_ACTIVITY act \n" +
" inner join(\n" +
" select activity.PRO_ID as PRO_ID,\n" +
" min(activity.NUMBER) as NUMBER_MIN\n" +
" from O_ACTIVITY activity\n" +
" join O_ACTIVITY prevActivity on prevActivity.ACT_ID = #actId#\n" +
" where activity.NUMBER > prevActivity.NUMBER \n" +
" \n" +
" and activity.PRO_ID = prevActivity.PRO_ID\n" +
" group by activity.PRO_ID\n" +
" ) actMin on (act.PRO_ID = actMin.PRO_ID and act.NUMBER = actMin.NUMBER_MIN)\n" +
" where 1=1",
taskEngineClass = io.vertigo.basics.task.TaskEngineSelect.class)
@io.vertigo.datamodel.task.proxy.TaskOutput(smartType = "STyDtOActivity", name = "dtOActivity")
public Optional getNextActivityByActId(@io.vertigo.datamodel.task.proxy.TaskInput(name = "actId", smartType = "STyOIdentifiant") final Long actId) {
final Task task = createTaskBuilder("TkGetNextActivityByActId")
.addValue("actId", actId)
.addContextProperty("connectionName", io.vertigo.datastore.impl.dao.StoreUtil.getConnectionName("orchestra"))
.build();
return Optional.ofNullable((io.vertigo.orchestra.domain.definition.OActivity) getTaskManager()
.execute(task)
.getResult());
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy