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());
  }
示例#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);
        }
      }
    }
  }
示例#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;
  }
示例#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;
 }
示例#6
0
 private static void checkForAspectManager() {
   if (aspectManager == null) {
     synchronized (Roma.class) {
       if (aspectManager == null) {
         aspectManager = Roma.component(AspectManager.class);
       }
     }
   }
 }
示例#7
0
 public static ReportingAspect reporting() {
   if (reportingAspect == null) {
     synchronized (Roma.class) {
       if (reportingAspect == null) {
         reportingAspect = Roma.aspect(ReportingAspect.class);
       }
     }
   }
   return reportingAspect;
 }
示例#8
0
 public static ViewAspect view() {
   if (viewAspect == null) {
     synchronized (Roma.class) {
       if (viewAspect == null) {
         viewAspect = Roma.aspect(ViewAspect.class);
       }
     }
   }
   return viewAspect;
 }
示例#9
0
 public static SchemaManager schema() {
   if (schemaManager == null) {
     synchronized (Roma.class) {
       if (schemaManager == null) {
         schemaManager = Roma.component(SchemaManager.class);
       }
     }
   }
   return schemaManager;
 }
示例#10
0
 public static LoggingAspect logging() {
   if (loggingAspect == null) {
     synchronized (Roma.class) {
       if (loggingAspect == null) {
         loggingAspect = Roma.aspect(LoggingAspect.ASPECT_NAME);
       }
     }
   }
   return loggingAspect;
 }
示例#11
0
 public static ScriptingAspect scripting() {
   if (scriptingAspect == null) {
     synchronized (Roma.class) {
       if (scriptingAspect == null) {
         scriptingAspect = Roma.aspect(ScriptingAspect.ASPECT_NAME);
       }
     }
   }
   return scriptingAspect;
 }
示例#12
0
 public static I18NAspect i18n() {
   if (i18nAspect == null) {
     synchronized (Roma.class) {
       if (i18nAspect == null) {
         i18nAspect = Roma.aspect(I18NAspect.ASPECT_NAME);
       }
     }
   }
   return i18nAspect;
 }
示例#13
0
 public static ValidationAspect validation() {
   if (validationAspect == null) {
     synchronized (Roma.class) {
       if (validationAspect == null) {
         validationAspect = Roma.aspect(ValidationAspect.ASPECT_NAME);
       }
     }
   }
   return validationAspect;
 }
示例#14
0
 public static SessionAspect session() {
   if (sessionAspect == null) {
     synchronized (Roma.class) {
       if (sessionAspect == null) {
         sessionAspect = Roma.aspect(SessionAspect.ASPECT_NAME);
       }
     }
   }
   return sessionAspect;
 }
示例#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();
  }
示例#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);
    }
  }
示例#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));
 }
示例#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;
 }
示例#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));
 }
示例#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));
 }