Advertisement
nmotter

Custom DataSource

Mar 10th, 2025
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 2.45 KB | Software | 0 0
  1. package com.acme.datastore.orgdata;
  2.  
  3. /**
  4.  *
  5.  *
  6.  */
  7. import java.util.HashSet;
  8. import java.util.Set;
  9.  
  10. import org.apache.logging.log4j.LogManager;
  11. import org.apache.logging.log4j.Logger;
  12. import org.yawlfoundation.yawl.exceptions.YAuthenticationException;
  13. import org.yawlfoundation.yawl.resourcing.datastore.orgdata.DataSource;
  14. import org.yawlfoundation.yawl.resourcing.datastore.orgdata.ResourceDataSet;
  15. import org.yawlfoundation.yawl.resourcing.resource.Capability;
  16. import org.yawlfoundation.yawl.resourcing.resource.OrgGroup;
  17. import org.yawlfoundation.yawl.resourcing.resource.Participant;
  18. import org.yawlfoundation.yawl.resourcing.resource.Position;
  19. import org.yawlfoundation.yawl.resourcing.resource.Role;
  20.  
  21. public class AcmeDataSourceImpl extends DataSource {
  22.     private static Logger logger = LogManager.getLogger(AcmeDataSourceImpl.class.getName());
  23.  
  24.     public ResourceDataSet loadResources() {
  25.         logger.info("ACME-Custom Loading Resources");
  26.  
  27.         ResourceDataSet ds = new ResourceDataSet(this);
  28.  
  29.         Capability capability = new Capability("Credit Check", "Run credit checks with agencies");
  30.         Set<Capability> capabilities = new HashSet<>();
  31.         capabilities.add(capability);
  32.         ds.addCapability(capability);
  33.  
  34.         OrgGroup orgGroup = new OrgGroup("ACME", OrgGroup.GroupType.CLUSTER, null, "ACME Organization");
  35.         ds.addOrgGroup(orgGroup);
  36.  
  37.         Position position = new Position("Manager", "ACME Platform Manager", "Manages the platform", orgGroup, null);
  38.         Set<Position> positions = new HashSet<>();
  39.         positions.add(position);
  40.         ds.addPosition(position);
  41.  
  42.         Role role = new Role();
  43.         role.setName("Aproval Specialist");
  44.         Set<Role> roles = new HashSet<>();
  45.         roles.add(role);
  46.         ds.addRole(role);
  47.  
  48.         Participant participant = new Participant("lastname", "firstname", "jdoe");
  49.         ds.addParticipant(participant);
  50.  
  51.         return ds;
  52.     }
  53.  
  54.     public void update(Object o) {
  55.         logger.info("update method");
  56.     }
  57.  
  58.     public boolean delete(Object o) {
  59.         return false;
  60.     }
  61.  
  62.     public String insert(Object o) {
  63.         return "none";
  64.     }
  65.  
  66.     public void importObj(Object o) {
  67.         logger.info("importObj");
  68.     }
  69.  
  70.     public int execUpdate(String string) {
  71.         return 0;
  72.     }
  73.  
  74.     public boolean authenticate(String string, String string1) throws YAuthenticationException {
  75.         return true;
  76.     }
  77.  
  78. }
  79.  
Tags: YAWL
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement