Skip to content

Instantly share code, notes, and snippets.

@romartin
Created December 15, 2015 23:44
Show Gist options
  • Select an option

  • Save romartin/5d7162d9b6f246163799 to your computer and use it in GitHub Desktop.

Select an option

Save romartin/5d7162d9b6f246163799 to your computer and use it in GitHub Desktop.
package org.uberfire.ext.wirez.bpmn.api;
import org.jboss.errai.common.client.api.annotations.Portable;
import org.uberfire.ext.wirez.bpmn.api.property.BPMNBasePropertyPack;
import org.uberfire.ext.wirez.bpmn.api.property.BPMNBgColorPropertyPack;
import org.uberfire.ext.wirez.bpmn.api.property.BgColorProperty;
import org.uberfire.ext.wirez.bpmn.api.role.*;
import org.uberfire.ext.wirez.core.api.factory.DefaultNodeFactory;
import org.uberfire.ext.wirez.core.api.graph.DefaultEdge;
import org.uberfire.ext.wirez.core.api.graph.DefaultNode;
import org.uberfire.ext.wirez.core.api.graph.Element;
import org.uberfire.ext.wirez.core.api.impl.WirezImpl;
import org.uberfire.ext.wirez.core.api.impl.content.DefaultContentImpl;
import org.uberfire.ext.wirez.core.api.impl.graph.NodeImpl;
import org.uberfire.ext.wirez.core.api.impl.property.DefaultElementPropertyPack;
import org.uberfire.ext.wirez.core.api.impl.property.NameProperty;
import org.uberfire.ext.wirez.core.api.model.content.Content;
import org.uberfire.ext.wirez.core.api.model.property.Property;
import org.uberfire.ext.wirez.core.api.model.property.PropertyPackage;
import org.uberfire.ext.wirez.core.api.model.role.Role;
import java.util.HashSet;
import java.util.Map;
import java.util.Set;
@Portable
public class Task extends WirezImpl<Content> implements BPMNWirez, DefaultNodeFactory<Task, DefaultNode<Task, DefaultEdge>> {
public static final Task INSTANCE = new Task();
public static final String ID = "Task";
private Set<Role> roles = new HashSet<Role>() {{
add( new BPMNRoleAll() );
add( new BPMNRoleSequenceStart() );
add( new BPMNRoleSequenceEnd() );
add( new BPMNRoleFromTaskEvent() );
add( new BPMNRoleToTaskEvent() );
add( new BPMNRoleFromEventbasedGateway() );
add( new BPMNRoleMessageflowStart() );
add( new BPMNRoleMessageflowEnd() );
add( new BPMNRoleFromToAll() );
add( new BPMNRoleActivitiesMorph() );
}};
private Set<Property> properties = new HashSet<Property>() {{
add( WirezImpl.clone(new NameProperty(), "My task") );
add( WirezImpl.clone(new BgColorProperty(), "#fafad2") );
}};
private Set<PropertyPackage> propertyPackages = new HashSet<PropertyPackage>() {{
add( new DefaultElementPropertyPack() );
add( new BPMNBasePropertyPack() );
add( new BPMNBgColorPropertyPack() );
}};
public Task() {
super(ID);
setContent(new DefaultContentImpl(BPMNCategory.INSTANCE.ACTIVITIES,
"Task",
"A task is a unit of work - the job to be performed.",
roles,
properties,
propertyPackages));
}
@Override
public DefaultNode<Task, DefaultEdge> build(String uuid, Map<String, Object> properties, Element.Bounds bounds) {
return new NodeImpl<Task>(uuid, this, properties, bounds);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment