예제 #1
0
  public void addData(ModuleData data) throws AccessNotAllowedException, NotEmptyException {

    if (data == null) throw new NotEmptyException("data cannot be empty");

    if (Tools.hasRight("ADD_DATA_TO_MODULE")) {
      data.setModule(this);
      moduleDatas.add(data);
    } else throw new AccessNotAllowedException("You can't add data to module");
  }
예제 #2
0
  public void setModuleController(String controller)
      throws AccessNotAllowedException, NotEmptyException {

    if (controller == null || controller.length() == 0)
      throw new NotEmptyException("controller cannot be empty");

    if (Tools.hasRight("SET_MODULE_CONTROLLER")) this.class1 = controller;
    else
      throw new AccessNotAllowedException("You can't edit a module controller as: " + controller);
  }
예제 #3
0
  public void addAction(ModuleAction action) throws AccessNotAllowedException, NotEmptyException {

    if (action == null) throw new NotEmptyException("action cannot be empty");

    if (Tools.hasRight("ADD_ACTION_TO_MODULE")) {
      action.setModule(this);
      action.persist();
      moduleActions.add(action);
    } else throw new AccessNotAllowedException("You can't add action to module");
  }
예제 #4
0
  public void removeData(ModuleData data) throws AccessNotAllowedException, NotEmptyException {

    if (data == null) throw new NotEmptyException("data cannot be empty");

    if (Tools.hasRight("REMOVE_DATA_FROM_MODULE")) {
      for (ModuleData gp : moduleDatas)
        if (gp.equals(data)) {
          gp.remove();
          break;
        }
    } else throw new AccessNotAllowedException("You can't remove data from module");
  }
예제 #5
0
  public void disallowAccess(AppGroup group) throws AccessNotAllowedException, NotEmptyException {

    if (group == null) throw new NotEmptyException("group cannot be empty");

    if (Tools.hasRight("REMOVE_MODULE_FROM_GROUP")) {
      for (ModuleGroup gp : moduleGroups)
        if (gp.getGroup().equals(group)) {
          gp.remove();
          break;
        }
    } else throw new AccessNotAllowedException("You can't remove group from module");
  }
예제 #6
0
  public void allowAccess(AppGroup group) throws AccessNotAllowedException, NotEmptyException {

    if (group == null) throw new NotEmptyException("group cannot be empty");

    if (Tools.hasRight("ADD_MODULE_TO_GROUP")) {
      ModuleGroup groupuser = new ModuleGroup();
      groupuser.setGroup(group);
      groupuser.setModule(this);
      groupuser.persist();
      moduleGroups.add(groupuser);
    } else throw new AccessNotAllowedException("You can't add group to module");
  }
예제 #7
0
  public void disallowAccess(AppRight right) throws AccessNotAllowedException, NotEmptyException {

    if (right == null) throw new NotEmptyException("right cannot be empty");

    if (Tools.hasRight("REMOVE_RIGHT_FROM_MODULE")) {
      for (ModuleRight gp : moduleRights)
        if (gp.getRight().equals(right)) {
          gp.remove();
          break;
        }
    } else throw new AccessNotAllowedException("You can't remove right from module");
  }
예제 #8
0
  public void allowAccess(AppRight right) throws AccessNotAllowedException, NotEmptyException {

    if (right == null) throw new NotEmptyException("right cannot be empty");

    if (Tools.hasRight("ADD_RIGHT_TO_MODULE")) {
      ModuleRight element = new ModuleRight();
      element.setModule(this);
      element.setRight(right);
      element.persist();
      moduleRights.add(element);
    } else throw new AccessNotAllowedException("You can't add right to module");
  }
예제 #9
0
  public void removeAction(ModuleAction action)
      throws AccessNotAllowedException, NotEmptyException {

    if (action == null) throw new NotEmptyException("action cannot be empty");

    if (Tools.hasRight("REMOVE_ACTION_FROM_MODULE")) {
      for (ModuleAction gp : moduleActions)
        if (gp.equals(action)) {
          gp.remove();
          break;
        }
    } else throw new AccessNotAllowedException("You can't remove action from module");
  }
 @Override
 public String toString() {
   return "Num: "
       + Tools.getValue(qs)
       + " Verb: "
       + verb
       + " Unit: "
       + unit
       + " NPs: "
       + Arrays.asList(connectedNPs)
       + " Rate : "
       + rateUnit;
 }
예제 #11
0
  public void setName(String name)
      throws AccessNotAllowedException, NotEmptyException, DataLengthException, DataFormatException,
          NotUniqueException {

    if (name == null || name.length() == 0) throw new NotEmptyException("name cannot be empty");

    if (name.length() > 100)
      throw new DataLengthException("ident parameter is too long (max: 100 carac)");

    if (isNameExist(name)) throw new NotUniqueException("name has to be unique");

    if (Tools.hasRight("SET_MODULE_NAME")) this.name = name;
    else throw new AccessNotAllowedException("You can't edit a module name as: " + name);
  }
 public Constituent getDependentVerb(Problem prob, QuantSpan qs) {
   Constituent result =
       getDependencyConstituentCoveringTokenId(
           prob, prob.ta.getTokenIdFromCharacterOffset(qs.start));
   if (result == null) {
     System.out.println(
         "Text : "
             + prob.question
             + " Token : "
             + prob.ta.getTokenIdFromCharacterOffset(qs.start));
     Tools.printCons(prob.dependency);
   }
   while (result != null) {
     if (result.getIncomingRelations().size() == 0) break;
     //			System.out.println(result.getIncomingRelations().get(0).getSource()+" --> "+result);
     result = result.getIncomingRelations().get(0).getSource();
     if (prob.posTags.get(result.getStartSpan()).getLabel().startsWith("VB")) {
       return result;
     }
   }
   return result;
 }
예제 #13
0
  public static AppModule create(String name, String description, String controller)
      throws AccessNotAllowedException, NotEmptyException, DataLengthException, NotUniqueException,
          DataFormatException {

    if (name == null || name.length() == 0) throw new NotEmptyException("name cannot be empty");

    if (name.length() > 100)
      throw new DataLengthException("ident parameter is too long (max: 100 carac)");

    if (controller == null || controller.length() == 0)
      throw new NotEmptyException("controller cannot be empty");

    if (isNameExist(name)) throw new NotUniqueException("name has to be unique");

    if (Tools.hasRight("ADD_MODULE")) {
      AppModule module = new AppModule();
      module.setName(name);
      module.setDescription(description);
      module.setModuleController(controller);
      module.persist();
      return module;
    } else throw new AccessNotAllowedException("You can't add a module entry");
  }
예제 #14
0
 public void update() throws AccessNotAllowedException {
   if (Tools.hasRight("UPDATE_MODULE")) this.merge();
   else throw new AccessNotAllowedException("You can't edit a filter entry");
 }
예제 #15
0
 public void delete() throws AccessNotAllowedException {
   if (Tools.hasRight("REMOVE_MODULE")) this.remove();
   else throw new AccessNotAllowedException("You can't delete a filter entry");
 }
예제 #16
0
  public void setEnabled(boolean enabled) throws AccessNotAllowedException {

    if (Tools.hasRight("SET_MODULE_ENABLED")) this.enabled = enabled;
    else throw new AccessNotAllowedException("You can't edit a module enabled as: " + enabled);
  }
예제 #17
0
 public static void main(String[] args) {
   Date date = Tools.getDateTime(new Date(), -7);
   System.out.println(date.toGMTString() + " == " + date.getTime());
   String str = "唐淑敏";
   byte[] bytes = str.getBytes(UTF8);
 }
예제 #18
0
 public void setDescription(String description) throws AccessNotAllowedException {
   if (Tools.hasRight("SET_MODULE_DESCRIPTION")) this.description = description;
   else throw new AccessNotAllowedException("You can't edit a module description");
 }