public static List<Application> getApplicationsInTarget(Domain me, String target) { if (target.equals("domain")) { // special target domain return me.getApplications().getApplications(); } List<Application> apps = new ArrayList<Application>(); List<ApplicationRef> applicationRefs = me.getApplicationRefsInTarget(target); for (ApplicationRef ref : applicationRefs) { Application app = me.getApplications().getApplication(ref.getRef()); if (app != null) { apps.add(app); } } return apps; }
public static List<Application> getApplicationsInTarget(Domain me, String target) { if (target.equals("domain")) { // special target domain return me.getApplications().getApplications(); } List<Application> apps = new ArrayList<Application>(); List<ApplicationRef> applicationRefs = me.getApplicationRefsInTarget(target); for (ApplicationRef ref : applicationRefs) { Application app = me.getApplications().getApplication(ref.getRef()); if (app != null) { apps.add(app); } } return apps; }
public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ActionReport.MessagePart part = report.getTopMessagePart(); part.setMessage(target); part.setChildrenType("application"); List<ApplicationRef> appRefs = domain.getApplicationRefsInTarget(target); for (ApplicationRef appRef : appRefs) { if (state.equals("all") || (state.equals("running") && Boolean.valueOf(appRef.getEnabled())) || (state.equals("non-running") && !Boolean.valueOf(appRef.getEnabled())) ) { if (isApplicationOfThisType(appRef.getRef(), type)) { ActionReport.MessagePart childPart = part.addChild(); childPart.setMessage(appRef.getRef()); } } } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); }
/** * Entry point from the framework into the command execution * @param context context for the command. */ public void execute(AdminCommandContext context) { final ActionReport report = context.getActionReport(); ColumnFormatter cf = new ColumnFormatter(); ActionReport.MessagePart part = report.getTopMessagePart(); int numOfApplications = 0; if ( !terse && long_opt ) { String[] headings= new String[] { "NAME", "STATUS" }; cf = new ColumnFormatter(headings); } for (ApplicationRef ref : domain.getApplicationRefsInTarget(target)) { Object[] row = new Object[] { ref.getRef() }; if( !terse && long_opt ){ row = new Object[]{ ref.getRef(), getLongStatus(ref) }; } cf.addRow(row); numOfApplications++; } if (numOfApplications != 0) { report.setMessage(cf.toString()); } else if ( !terse) { part.setMessage(localStrings.getLocalString("list.components.no.elements.to.list", "Nothing to List.")); } report.setActionExitCode(ActionReport.ExitCode.SUCCESS); }