Exemplo n.º 1
0
  @Override
  public Object run(Session session, String dbName, Object... input) {

    if (input.length != 3) {
      throw new IllegalArgumentException("Expected input of length 3");
    }

    if (!(input[0] instanceof Object[])) {
      throw new IllegalArgumentException("Expected input[0] to be an Object array");
    }

    if (!(input[1] instanceof Task)) {
      throw new IllegalArgumentException("Expected input[1] to be a Task");
    }

    if (!(input[2] instanceof TaskManager)) {
      throw new IllegalArgumentException("Expected input[2] to be a TaskManager");
    }

    Object[] args = (Object[]) input[0];

    Task taskToRun = (Task) input[1];

    TaskManager taskMgr = (TaskManager) input[2];

    if (taskToRun == taskMgr.getInsertTask()) {
      return dfltTaskMgr.getMergeForInsertTask().run(session, dbName, args);
    } else if (taskToRun == taskMgr.getUpdateTask()) {
      return dfltTaskMgr.getMergeForUpdateTask().run(session, dbName, args);
    } else {
      return args;
    }
  }
Exemplo n.º 2
0
 public TypedServiceReturn read(
     TypeDefinition rootType,
     Object o,
     PropertyOptions propertyOptions,
     PagingOptions pagingOptions) {
   return ((TypedServiceReturn)
       dsMgr.invoke(taskMgr.getReadTask(), rootType, o, propertyOptions, pagingOptions));
 }
Exemplo n.º 3
0
 public com.xedb.data.Rol getRolById(String id, PagingOptions pagingOptions) {
   List<com.xedb.data.Rol> rtn =
       ((List<com.xedb.data.Rol>)
           dsMgr.invoke(
               taskMgr.getQueryTask(), (XeDBConstants.getRolByIdQueryName), id, pagingOptions));
   if (rtn.isEmpty()) {
     return null;
   } else {
     return rtn.get(0);
   }
 }
Exemplo n.º 4
0
 public com.testdb.data.SiCliModulo getSiCliModuloById(Integer id, PagingOptions pagingOptions) {
   List<com.testdb.data.SiCliModulo> rtn =
       ((List<com.testdb.data.SiCliModulo>)
           dsMgr.invoke(
               taskMgr.getQueryTask(),
               (TestDBConstants.getSiCliModuloByIdQueryName),
               id,
               pagingOptions));
   if (rtn.isEmpty()) {
     return null;
   } else {
     return rtn.get(0);
   }
 }
Exemplo n.º 5
0
 public com.hrdb.data.Department getDepartmentById(Integer id, PagingOptions pagingOptions) {
   List<com.hrdb.data.Department> rtn =
       ((List<com.hrdb.data.Department>)
           dsMgr.invoke(
               taskMgr.getQueryTask(),
               (HrdbConstants.getDepartmentByIdQueryName),
               id,
               pagingOptions));
   if (rtn.isEmpty()) {
     return null;
   } else {
     return rtn.get(0);
   }
 }
Exemplo n.º 6
0
 public void delete(Object o) {
   dsMgr.invoke(taskMgr.getDeleteTask(), o);
 }
Exemplo n.º 7
0
 public Object update(Object o) {
   return dsMgr.invoke(taskMgr.getUpdateTask(), o);
 }
Exemplo n.º 8
0
 public Object insert(Object o) {
   return dsMgr.invoke(taskMgr.getInsertTask(), o);
 }