use of org.eclipse.sapphire.Version in project liferay-ide by liferay.
the class EmailAddressValidationService method _getSchemaVersion.
private Version _getSchemaVersion() {
Version schemaVersion = new Version(KaleoCore.DEFAULT_KALEO_VERSION);
if (context(WorkflowDefinition.class) != null) {
WorkflowDefinition workflowDefinition = context(WorkflowDefinition.class);
Value<Version> version = workflowDefinition.getSchemaVersion();
schemaVersion = version.content();
} else if (context(NewNodeOp.class) != null) {
NewNodeOp newNodeOp = context(NewNodeOp.class);
ElementHandle<WorkflowDefinition> workflowDef = newNodeOp.getWorkflowDefinition();
WorkflowDefinition workflowDefinition = workflowDef.content();
Value<Version> version = workflowDefinition.getSchemaVersion();
schemaVersion = version.content();
} else if (context(NewWorkflowDefinitionOp.class) != null) {
NewWorkflowDefinitionOp newWorkflowDenitionOp = context(NewWorkflowDefinitionOp.class);
ReferenceValue<String, IProject> opProject = newWorkflowDenitionOp.getProject();
IProject project = opProject.target();
ILiferayProject liferayProj = LiferayCore.create(project);
ILiferayPortal portal = liferayProj.adapt(ILiferayPortal.class);
if (portal != null) {
schemaVersion = new Version(portal.getVersion());
}
}
return schemaVersion;
}
use of org.eclipse.sapphire.Version in project liferay-ide by liferay.
the class EmailAddressValidationService method initValidationService.
@Override
protected void initValidationService() {
super.initValidationService();
Version schemaVersion = _getSchemaVersion();
_shouldValidate = schemaVersion.compareTo(new Version("6.2")) >= 0;
}
use of org.eclipse.sapphire.Version in project liferay-ide by liferay.
the class NotificationTransportValuesService method compute.
@Override
protected void compute(Set<String> values) {
values.add("email");
values.add("im");
values.add("private-message");
Value<Version> schemaVersion = context(WorkflowDefinition.class).getSchemaVersion();
final Version version = schemaVersion.content();
if (_v62.compareTo(version) <= 0) {
values.add("user-notification");
}
}
use of org.eclipse.sapphire.Version in project liferay-ide by liferay.
the class TransitionReferenceService method compute.
@Override
public Node compute() {
String reference = context(Value.class).text();
if (reference != null) {
WorkflowDefinition workflow = context(WorkflowDefinition.class);
List<Node> nodes = new ArrayList<>();
if (workflow != null) {
nodes.addAll(workflow.getTasks());
nodes.addAll(workflow.getStates());
nodes.addAll(workflow.getConditions());
nodes.addAll(workflow.getForks());
nodes.addAll(workflow.getJoins());
Value<Version> schemaVersion = workflow.getSchemaVersion();
Version version = schemaVersion.content();
if (version.compareTo(new Version("6.2")) >= 0) {
nodes.addAll(workflow.getJoinXors());
}
for (Node node : nodes) {
if (reference.equals(node.getName().content())) {
return node;
}
}
}
}
return null;
}
use of org.eclipse.sapphire.Version in project liferay-ide by liferay.
the class TransitionPossibleValuesService method compute.
@Override
protected void compute(Set<String> values) {
/*
* if we are a task return states and tasks, if we are a state, find
* tasks.
*/
Element modelElement = context(Element.class);
WorkflowDefinition workflow = modelElement.nearest(WorkflowDefinition.class);
if (workflow == null) {
workflow = modelElement.adapt(WorkflowDefinition.class);
}
if (workflow != null) {
addNodeNames(values, workflow.getTasks());
addNodeNames(values, workflow.getStates());
addNodeNames(values, workflow.getConditions());
addNodeNames(values, workflow.getForks());
addNodeNames(values, workflow.getJoins());
Value<Version> schemaVersion = workflow.getSchemaVersion();
Version version = schemaVersion.content();
if (version.compareTo(new Version("6.2")) >= 0) {
addNodeNames(values, workflow.getJoinXors());
}
}
}
Aggregations