2 * ============LICENSE_START====================================================
4 * ===========================================================================
5 * Copyright (c) 2018 AT&T Intellectual Property. All rights reserved.
7 * Modifications Copyright © 2018 IBM.
8 * ===========================================================================
9 * Licensed under the Apache License, Version 2.0 (the "License");
10 * you may not use this file except in compliance with the License.
11 * You may obtain a copy of the License at
13 * http://www.apache.org/licenses/LICENSE-2.0
15 * Unless required by applicable law or agreed to in writing, software
16 * distributed under the License is distributed on an "AS IS" BASIS,
17 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
18 * See the License for the specific language governing permissions and
19 * limitations under the License.
20 * ============LICENSE_END====================================================
24 package org.onap.aaf.auth.batch.actions;
26 import java.io.PrintStream;
28 import org.onap.aaf.auth.env.AuthzTrans;
29 import org.onap.aaf.auth.layer.Result;
30 import org.onap.aaf.auth.org.Organization;
32 public class EmailPrint extends Email {
34 private static final int LINE_LENGTH = 100;
36 public EmailPrint(String... defaultCC) {
41 * @see org.onap.aaf.auth.actions.Email#exec(org.onap.aaf.auth.org.test.Organization, java.lang.StringBuilder)
44 protected Result<Void> exec(AuthzTrans trans, Organization org, StringBuilder msg) {
45 PrintStream out = System.out;
48 for (String s: toList) {
52 else {out.print(',');}
59 for (String s: ccList) {
63 else {out.print(',');}
68 out.print("Subject: ");
73 for (int start=0, end=LINE_LENGTH;go;start=end,end=Math.min(msg.length(), start+LINE_LENGTH)) {
74 int ret = msg.indexOf("\n",start+1);
77 out.println(msg.substring(start,end));
87 if (end==start+LINE_LENGTH) {
89 ret = msg.lastIndexOf(" ", end);
90 if (ret>start && ret<end) {
93 out.println(msg.substring(start,end));
95 out.print(msg.substring(start,end));
98 go = end<msg.length();