/** * Check if the user is this procedure's owner * @param procId the target procedure * @param user the user * @return true if the user is the owner of the procedure, * false otherwise or the owner is unknown. */ public boolean isProcedureOwner(long procId, User user) { if (user == null) { return false; } final Procedure<TEnvironment> runningProc = procedures.get(procId); if (runningProc != null) { return runningProc.getOwner().equals(user.getShortName()); } final CompletedProcedureRetainer<TEnvironment> retainer = completed.get(procId); if (retainer != null) { return retainer.getProcedure().getOwner().equals(user.getShortName()); } // Procedure either does not exist or has already completed and got cleaned up. // At this time, we cannot check the owner of the procedure return false; }
public static String describe(Procedure<?> proc) { Map<String, Object> description = new LinkedHashMap<>(); description.put("ID", proc.getProcId()); description.put("PARENT_ID", proc.getParentProcId()); description.put("STATE", proc.getState()); description.put("OWNER", proc.getOwner()); description.put("TYPE", proc.getProcName()); description.put("START_TIME", new Date(proc.getSubmittedTime())); description.put("LAST_UPDATE", new Date(proc.getLastUpdate())); if (proc.isFailed()) { description.put("ERRORS", MasterProcedureUtil.unwrapRemoteIOException(proc).getMessage()); } description.put("PARAMETERS", parametersToObject(proc)); return JRubyFormat.print(description); }
out.print( escapeXml(proc.getState().toString() + (proc.isBypass() ? "(Bypass)" : "")) ); out.write("</td>\n <td>"); out.print( proc.hasOwner() ? escapeXml(proc.getOwner()) : "" ); out.write("</td>\n <td>"); out.print( escapeXml(proc.getProcName()) );
builder.setOwner(proc.getOwner());
/** * Check if the user is this procedure's owner * @param procId the target procedure * @param user the user * @return true if the user is the owner of the procedure, * false otherwise or the owner is unknown. */ public boolean isProcedureOwner(final long procId, final User user) { if (user == null) return false; final Procedure runningProc = procedures.get(procId); if (runningProc != null) { return runningProc.getOwner().equals(user.getShortName()); } final CompletedProcedureRetainer retainer = completed.get(procId); if (retainer != null) { return retainer.getProcedure().getOwner().equals(user.getShortName()); } // Procedure either does not exist or has already completed and got cleaned up. // At this time, we cannot check the owner of the procedure return false; }
/** * Check if the user is this procedure's owner * @param procId the target procedure * @param user the user * @return true if the user is the owner of the procedure, * false otherwise or the owner is unknown. */ public boolean isProcedureOwner(long procId, User user) { if (user == null) { return false; } final Procedure<TEnvironment> runningProc = procedures.get(procId); if (runningProc != null) { return runningProc.getOwner().equals(user.getShortName()); } final CompletedProcedureRetainer<TEnvironment> retainer = completed.get(procId); if (retainer != null) { return retainer.getProcedure().getOwner().equals(user.getShortName()); } // Procedure either does not exist or has already completed and got cleaned up. // At this time, we cannot check the owner of the procedure return false; }
/** * Check if the user is this procedure's owner * @param procId the target procedure * @param user the user * @return true if the user is the owner of the procedure, * false otherwise or the owner is unknown. */ public boolean isProcedureOwner(final long procId, final User user) { if (user == null) { return false; } Procedure proc = procedures.get(procId); if (proc != null) { return proc.getOwner().equals(user.getShortName()); } ProcedureInfo procInfo = completed.get(procId); if (procInfo == null) { // Procedure either does not exist or has already completed and got cleaned up. // At this time, we cannot check the owner of the procedure return false; } return ProcedureInfo.isProcedureOwner(procInfo, user); }
@Override public String toString() { StringBuilder sb = new StringBuilder(); toStringClassDetails(sb); if (procId != null) { sb.append(" id="); sb.append(getProcId()); } if (hasParent()) { sb.append(" parent="); sb.append(getParentProcId()); } if (hasOwner()) { sb.append(" owner="); sb.append(getOwner()); } sb.append(" state="); toStringState(sb); return sb.toString(); }
/** * Helper to create the ProcedureInfo from Procedure. */ @InterfaceAudience.Private public static ProcedureInfo createProcedureInfo(final Procedure proc, final NonceKey nonceKey) { RemoteProcedureException exception = proc.hasException() ? proc.getException() : null; return new ProcedureInfo( proc.getProcId(), proc.toStringClass(), proc.getOwner(), proc.getState(), proc.hasParent() ? proc.getParentProcId() : -1, nonceKey, exception != null ? RemoteProcedureException.toProto(exception.getSource(), exception.getCause()) : null, proc.getLastUpdate(), proc.getStartTime(), proc.getResult()); }
builder.setOwner(proc.getOwner());
builder.setOwner(proc.getOwner());
builder.setOwner(proc.getOwner());