public void executeNow() {
    Object[] triggers = getSelection();

    if (triggers == null) {
      Roma.flow()
          .popup(new MessageOk("1", "$Message.Warning", null, "$CRUDMain.selectAtLeastOne.error"));
      return;
    }

    for (Object trigger : triggers) {
      Roma.aspect(SchedulerAspect.class)
          .executeNow(((QuartzSchedulerEventListable) trigger).getEntity());
    }
  }
  public void pause() throws InstantiationException, IllegalAccessException {

    Object[] triggers = getSelection();
    for (Object trigger : triggers)
      Roma.aspect(SchedulerAspect.class)
          .pauseJob(((QuartzSchedulerEventListable) trigger).getEntity());
  }
Ejemplo n.º 3
0
  /**
   * Refresh a property feature and/or value of iUserSession session.
   *
   * @param iUserSession The User Session
   * @param iUserObject The User Object of changed property
   * @param iFieldNames Optional field names to signal the change
   */
  public static void fieldChanged(
      SessionInfo iUserSession, Object iUserObject, String... iFieldNames) {
    if (iUserObject == null) return;

    if (iUserSession == null) iUserSession = component(SessionAspect.class).getActiveSessionInfo();

    List<FieldRefreshListener> listeners =
        Controller.getInstance().getListeners(FieldRefreshListener.class);

    synchronized (listeners) {
      SchemaObject sObj = Roma.session().getSchemaObject(iUserObject);
      if (sObj == null) return;

      if (iFieldNames == null || iFieldNames.length == 0) {
        // REFRESH ALL FIELDS
        for (Iterator<SchemaField> it = sObj.getFieldIterator(); it.hasNext(); )
          signalFieldChanged(iUserSession, iUserObject, listeners, sObj, it.next().getName());
      } else {
        // REFRESH PASSED FIELDS
        for (String fieldName : iFieldNames) {
          signalFieldChanged(iUserSession, iUserObject, listeners, sObj, fieldName);
        }
      }
    }
  }
Ejemplo n.º 4
0
  private static <T> SchemaFeatures getSchemaFeature(
      Object iUserObject, String elementName, Feature<T> feature) {
    SchemaObject schema = Roma.session().getSchemaObject(iUserObject);
    if (schema == null) return null;
    SchemaFeatures features = null;
    if (FeatureType.ACTION.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getAction(elementName);
      if (features == null) {
        if (schema.getSchemaClass().getAction(elementName) == null)
          throw new ConfigurationException(
              "Action '" + elementName + "' not found in class '" + schema + "'");
      }
    } else if (FeatureType.FIELD.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getField(elementName);
      if (features == null) {
        if (schema.getSchemaClass().getField(elementName) == null)
          throw new ConfigurationException(
              "Field '" + elementName + "' not found in class '" + schema + "'");
      }
    } else if (FeatureType.CLASS.equals(feature.getType())) features = schema;
    else if (FeatureType.EVENT.equals(feature.getType())) {
      if (elementName == null) return null;
      features = schema.getEvent(elementName);
    }

    return features;
  }
Ejemplo n.º 5
0
 /**
  * Retrieve the repository (if defined) for a particular domain class.
  *
  * @param <T> the type of the object that will be returned
  * @param <Z> the type of domain class.
  * @param entityClass the {@link SchemaClass} of domain class.
  * @return the repository instance.
  */
 public static <T extends GenericRepository<?>> T repository(SchemaClass entityClass) {
   if (entityClass != null) {
     String repositoryName = entityClass.getName() + "Repository";
     return Roma.autoComponent(repositoryName);
   }
   return null;
 }
Ejemplo n.º 6
0
 private static void checkForAspectManager() {
   if (aspectManager == null) {
     synchronized (Roma.class) {
       if (aspectManager == null) {
         aspectManager = Roma.component(AspectManager.class);
       }
     }
   }
 }
Ejemplo n.º 7
0
 public static ReportingAspect reporting() {
   if (reportingAspect == null) {
     synchronized (Roma.class) {
       if (reportingAspect == null) {
         reportingAspect = Roma.aspect(ReportingAspect.class);
       }
     }
   }
   return reportingAspect;
 }
Ejemplo n.º 8
0
 public static ViewAspect view() {
   if (viewAspect == null) {
     synchronized (Roma.class) {
       if (viewAspect == null) {
         viewAspect = Roma.aspect(ViewAspect.class);
       }
     }
   }
   return viewAspect;
 }
Ejemplo n.º 9
0
 public static SchemaManager schema() {
   if (schemaManager == null) {
     synchronized (Roma.class) {
       if (schemaManager == null) {
         schemaManager = Roma.component(SchemaManager.class);
       }
     }
   }
   return schemaManager;
 }
Ejemplo n.º 10
0
 public static LoggingAspect logging() {
   if (loggingAspect == null) {
     synchronized (Roma.class) {
       if (loggingAspect == null) {
         loggingAspect = Roma.aspect(LoggingAspect.ASPECT_NAME);
       }
     }
   }
   return loggingAspect;
 }
Ejemplo n.º 11
0
 public static ScriptingAspect scripting() {
   if (scriptingAspect == null) {
     synchronized (Roma.class) {
       if (scriptingAspect == null) {
         scriptingAspect = Roma.aspect(ScriptingAspect.ASPECT_NAME);
       }
     }
   }
   return scriptingAspect;
 }
Ejemplo n.º 12
0
 public static I18NAspect i18n() {
   if (i18nAspect == null) {
     synchronized (Roma.class) {
       if (i18nAspect == null) {
         i18nAspect = Roma.aspect(I18NAspect.ASPECT_NAME);
       }
     }
   }
   return i18nAspect;
 }
Ejemplo n.º 13
0
 public static ValidationAspect validation() {
   if (validationAspect == null) {
     synchronized (Roma.class) {
       if (validationAspect == null) {
         validationAspect = Roma.aspect(ValidationAspect.ASPECT_NAME);
       }
     }
   }
   return validationAspect;
 }
Ejemplo n.º 14
0
 public static SessionAspect session() {
   if (sessionAspect == null) {
     synchronized (Roma.class) {
       if (sessionAspect == null) {
         sessionAspect = Roma.aspect(SessionAspect.ASPECT_NAME);
       }
     }
   }
   return sessionAspect;
 }
Ejemplo n.º 15
0
 public static FlowAspect flow() {
   if (flowAspect == null) {
     synchronized (Roma.class) {
       if (flowAspect == null) {
         flowAspect = Roma.aspect(FlowAspect.class);
       }
     }
   }
   return flowAspect;
 }
  @Override
  public void delete() throws InstantiationException, IllegalAccessException {

    Object[] triggers = getSelection();
    for (Object trigger : triggers)
      Roma.aspect(SchedulerAspect.class)
          .unSchedule(((QuartzSchedulerEventListable) trigger).getEntity());

    super.delete();
  }
Ejemplo n.º 17
0
  /**
   * Refresh an object.
   *
   * @see ObjectContext#objectChanged(SessionInfo, Object)
   * @param iUserSession The User Session
   * @param iUserObject The User Object of changed property
   */
  public static void objectChanged(SessionInfo iUserSession, Object iUserObject) {
    if (iUserObject == null) return;

    if (iUserSession == null) iUserSession = Roma.session().getActiveSessionInfo();

    List<ObjectRefreshListener> listeners =
        Controller.getInstance().getListeners(ObjectRefreshListener.class);

    for (ObjectRefreshListener objectRefreshListener : listeners) {
      objectRefreshListener.onObjectRefresh(iUserSession, iUserObject);
    }
  }
Ejemplo n.º 18
0
 /**
  * returns a domain factory (if defined) for a particular domain class
  *
  * @param <T> the type of the object that will be returned
  * @param entityClass the class (simple) name of the domain class
  * @return a domain factory (if defined) for a particular domain class
  */
 public static <T extends GenericFactory<?>> T factory(String entityClass) {
   return (T) factory(Roma.schema().getSchemaClass(entityClass));
 }
Ejemplo n.º 19
0
 /**
  * Retrieve the repository (if defined) for a particular domain class.
  *
  * @param <T> the type of the object that will be returned
  * @param <Z> the type of domain class.
  * @param entityClass the {@link Class<Z>} of domain class.
  * @return the repository instance.
  */
 public static <Z, T extends GenericRepository<Z>> T repository(Class<Z> entityClass) {
   return entityClass != null ? (T) repository(Roma.schema().getSchemaClass(entityClass)) : null;
 }
Ejemplo n.º 20
0
 /**
  * Retrieve the repository (if defined) for a particular domain class.
  *
  * @param <T> the type of the object that will be returned
  * @param <Z> the type of domain class.
  * @param entityClass the simple name of domain class.
  * @return the repository instance.
  */
 public static <T extends GenericRepository<?>> T repository(String entityClass) {
   return (T) repository(Roma.schema().getSchemaClass(entityClass));
 }
Ejemplo n.º 21
0
 /**
  * @param <T>
  * @param entityClass
  * @return
  */
 public static <T extends GenericFactory<Z>, Z> T factory(Class<Z> entityClass) {
   return (T) factory(Roma.schema().getSchemaClass(entityClass));
 }