Exemple #1
0
 /**
  * Iterates through block4 fields and return all occurrences of fields whose names matches 97A, or
  * <code>Collections.emptyList()</code> if none is found.<br>
  * Multiple occurrences of field 97A at MT370 are expected at one sequence or across several
  * sequences.
  *
  * @return a List of Field97A objects or <code>Collections.emptyList()</code> if none is not found
  * @see SwiftTagListBlock#getTagsByName(String)
  * @throws IllegalStateException if SwiftMessage object is not initialized
  */
 public List<Field97A> getField97A() {
   if (getSwiftMessage() == null) {
     throw new IllegalStateException("SwiftMessage was not initialized");
   }
   if (getSwiftMessage().getBlock4() == null) {
     log.info("block4 is null");
     return Collections.emptyList();
   } else {
     final Tag[] tags = getSwiftMessage().getBlock4().getTagsByName("97A");
     final List<Field97A> result = new ArrayList<Field97A>();
     for (int i = 0; i < tags.length; i++) {
       result.add(new Field97A(tags[i].getValue()));
     }
     return result;
   }
 }
Exemple #2
0
 /**
  * Iterates through block4 fields and return the first one whose name matches 72, or <code>null
  * </code> if none is found.<br>
  * The first occurrence of field 72 at MT291 is expected to be the only one.
  *
  * @return a Field72 object or <code>null</code> if the field is not found
  * @see SwiftTagListBlock#getTagByName(String)
  * @throws IllegalStateException if SwiftMessage object is not initialized
  */
 public Field72 getField72() {
   if (getSwiftMessage() == null) {
     throw new IllegalStateException("SwiftMessage was not initialized");
   }
   if (getSwiftMessage().getBlock4() == null) {
     log.info("block4 is null");
     return null;
   } else {
     final Tag t = getSwiftMessage().getBlock4().getTagByName("72");
     if (t == null) {
       log.fine("field 72 not found");
       return null;
     } else {
       return new Field72(t.getValue());
     }
   }
 }