@Atomic
  public static void run(InfoShift infoShift, List<String> schoolClassOIDs)
      throws FenixServiceException {
    check(RolePredicates.RESOURCE_ALLOCATION_MANAGER_PREDICATE);

    final Shift shift = FenixFramework.getDomainObject(infoShift.getExternalId());
    if (shift == null) {
      throw new InvalidArgumentsServiceException();
    }

    for (final String schoolClassOID : schoolClassOIDs) {
      final SchoolClass schoolClass = FenixFramework.getDomainObject(schoolClassOID);
      if (schoolClass == null) {
        throw new InvalidArgumentsServiceException();
      }

      shift.associateSchoolClass(schoolClass);
    }
  }
Exemple #2
0
 @Atomic
 public static Object run(final InfoShift infoShift, final InfoClass infoClass) {
   check(RolePredicates.RESOURCE_ALLOCATION_MANAGER_PREDICATE);
   final Shift shift = FenixFramework.getDomainObject(infoShift.getExternalId());
   if (shift == null) {
     return Boolean.FALSE;
   }
   final SchoolClass schoolClass =
       (SchoolClass)
           CollectionUtils.find(
               shift.getAssociatedClassesSet(),
               new Predicate() {
                 @Override
                 public boolean evaluate(Object arg0) {
                   final SchoolClass schoolClass = (SchoolClass) arg0;
                   return schoolClass.getExternalId().equals(infoClass.getExternalId());
                 }
               });
   if (schoolClass == null) {
     return Boolean.FALSE;
   }
   shift.getAssociatedClassesSet().remove(schoolClass);
   return Boolean.TRUE;
 }