List of usage examples for org.apache.commons.lang StringUtils equalsIgnoreCase
public static boolean equalsIgnoreCase(String str1, String str2)
Compares two Strings, returning true
if they are equal ignoring the case.
From source file:hydrograph.ui.graph.editor.JobDeleteParticipant.java
private boolean deleteCorrospondingXmlAndPropertyFileifUserDeleteJobFile(IProject iProject) { if (modifiedResource.getProjectRelativePath() != null && StringUtils.equalsIgnoreCase( modifiedResource.getProjectRelativePath().segment(0), CustomMessages.ProjectSupport_JOBS)) { IFile propertyFileName = null;/*w w w. ja v a2 s .com*/ IFolder jobsFolder = iProject.getFolder(CustomMessages.ProjectSupport_JOBS); IFolder propertiesFolder = iProject.getFolder(Messages.PARAM); if (jobsFolder != null) { xmlIFile = jobsFolder.getFile(modifiedResource.getFullPath().removeFirstSegments(2) .removeFileExtension().addFileExtension(Constants.XML_EXTENSION_FOR_IPATH)); } if (propertiesFolder != null) { propertyFileName = propertiesFolder.getFile(modifiedResource.getFullPath().removeFileExtension() .addFileExtension(Constants.PROPERTIES).toFile().getName()); } String message = getErrorMessageIfUserDeleteJobRelatedFiles(propertyFileName, xmlIFile); showErrorMessage(xmlIFile, propertyFileName, Messages.bind(message, modifiedResource.getName())); } else { flag = true; } return flag; }
From source file:de.unioninvestment.eai.portal.portlet.crud.scripting.domain.container.rest.ValueConverter.java
private Object convertStringToDate(String format, Locale locale, String value) { try {//from ww w.ja va 2s.c om if (StringUtils.isBlank(value)) { return null; } else if (StringUtils.equalsIgnoreCase(format, "iso8601")) { Calendar calendar = DatatypeConverter.parseDateTime(value); return calendar.getTime(); } else { // SimpleDateFormat return new SimpleDateFormat(format, locale).parse(value); } } catch (ParseException e) { throw new IllegalArgumentException("Cannot convert to date: " + value, e); } }
From source file:hydrograph.ui.graph.editor.RenameJobParticipant.java
@Override public Change createChange(IProgressMonitor pm) throws CoreException, OperationCanceledException { final HashMap<IFile, RenameResourceChange> changes = new HashMap<IFile, RenameResourceChange>(); final String newName = ResourceChangeUtil.removeExtension(getArguments().getNewName()); if (modifiedResource.getParent() != null) { if (!StringUtils.equalsIgnoreCase(modifiedResource.getParent().getName(), CustomMessages.ProjectSupport_JOBS)) { List<IResource> memberList = new ArrayList<IResource>(modifiedResource.getProject() .getFolder(modifiedResource.getParent().getName()).members().length); ResourceChangeUtil.addMembersToList(memberList, modifiedResource.getProject().getFolder(modifiedResource.getParent().getName())); final String fileName = ResourceChangeUtil.removeExtension(modifiedResource.getName()); for (IResource resource : memberList) { if (Pattern.matches(fileName + Constants.EXTENSION, resource.getName())) { if ((StringUtils.equalsIgnoreCase(Messages.XML_EXT, resource.getFileExtension()) || StringUtils.equalsIgnoreCase(Messages.JOB_EXT, resource.getFileExtension())) && !(StringUtils.equalsIgnoreCase(modifiedResource.getName(), resource.getName()))) { getRenameChanges(changes, newName, resource); }/* w w w.java 2 s.c o m*/ } } } else if (StringUtils.equalsIgnoreCase(modifiedResource.getParent().getName(), CustomMessages.ProjectSupport_JOBS) || StringUtils.equalsIgnoreCase(modifiedResource.getParent().getName(), CustomMessages.ProjectSupport_PARAM)) { List<IResource> memberList = new ArrayList<IResource>(modifiedResource.getProject() .getFolder(CustomMessages.ProjectSupport_PARAM).members().length + modifiedResource.getProject().getFolder(CustomMessages.ProjectSupport_JOBS) .members().length); ResourceChangeUtil.addMembersToList(memberList, modifiedResource.getProject().getFolder(CustomMessages.ProjectSupport_JOBS)); ResourceChangeUtil.addMembersToList(memberList, modifiedResource.getProject().getFolder(CustomMessages.ProjectSupport_PARAM)); final String fileName = ResourceChangeUtil.removeExtension(modifiedResource.getName()); for (IResource resource : memberList) { if (Pattern.matches(fileName + Constants.EXTENSION, resource.getName())) { if ((StringUtils.equalsIgnoreCase(Messages.XML_EXT, resource.getFileExtension()) || StringUtils.equalsIgnoreCase(Messages.PROPERTIES_EXT, resource.getFileExtension()) || StringUtils.equalsIgnoreCase(Messages.JOB_EXT, resource.getFileExtension())) && !(StringUtils.equalsIgnoreCase(modifiedResource.getName(), resource.getName()))) { getRenameChanges(changes, newName, resource); } ; } } } } if (changes.isEmpty()) { return null; } CompositeChange result = new CompositeChange("Rename Job Related Files"); for (Iterator<RenameResourceChange> iter = changes.values().iterator(); iter.hasNext();) { result.add((Change) iter.next()); } return result; }
From source file:com.edgenius.wiki.ext.todo.model.Todo.java
public boolean isDirtyStatus(String statusString, String deleteAction) { if (StringUtils.isBlank(statusString)) { //if input is blank, set it as dirty, then it will be replaced by system status replaced. return true; }//from ww w . j a va 2s. com String[] list = statusString.split("[, ]+"); if (list.length != statuses.size()) return true; String currDeleteAction = null; boolean dirty; for (TodoStatus status : statuses) { dirty = true; for (String str : list) { if (StringUtils.equalsIgnoreCase(str, status.getText())) { dirty = false; break; } } if (dirty) return dirty; currDeleteAction = status.isDeleteAction() ? status.getText() : null; } if (!StringUtils.equalsIgnoreCase(deleteAction, currDeleteAction)) return false; return false; }
From source file:gov.nih.nci.cabig.caaers.web.ae.ReviewAndReportTab.java
@Override public void onBind(HttpServletRequest request, CaptureAdverseEventInputCommand command, Errors errors) { super.onBind(request, command, errors); ReviewAndReportResult reviewResult = new ReviewAndReportResult(); command.setReviewResult(reviewResult); //set the reporting period id. reviewResult.setReportingPeriodId(command.getAdverseEventReportingPeriod().getId()); Map<Integer, ReportDefinition> rdMap = command.getApplicableReportDefinitions().getReportDefinitionMap(); try {/*from w w w .j a va 2 s.c o m*/ //find the aeReport Integer aeReportId = ServletRequestUtils.getIntParameter(request, "activeAeReportId"); reviewResult.setAeReportId(aeReportId); //bind the start dates List<AdverseEvent> adverseEvents = command.getEvaluationResult().getAllAeMap().get(aeReportId); int size = adverseEvents.size(); for (int i = 0; i < size; i++) { AdverseEvent ae = adverseEvents.get(i); String startDateParamName = "evaluationResult.allAeMap[" + aeReportId.intValue() + "][" + i + "].startDate"; if (WebUtils.hasParameter(request, startDateParamName)) { String strStartDate = request.getParameter(startDateParamName); if (StringUtils.isNotEmpty(strStartDate)) { ae.setStartDate(DateUtils.parseDateString(strStartDate).toDate()); } else { ae.setStartDate(null); } } } String paramName = "rd_" + aeReportId.toString(); //selected report definition ids int[] selectedRdIds = ServletRequestUtils.getIntParameters(request, paramName + "_checked"); //all report definition ids int[] rdIds = ServletRequestUtils.getIntParameters(request, paramName); for (int rdId : rdIds) { //fetch the manual selection indicator String strManualIndicator = ServletRequestUtils.getStringParameter(request, paramName + "_" + rdId + "_manual"); reviewResult.getManualSelectionIndicatorMap().put(new Integer(rdId), StringUtils.equals("1", strManualIndicator)); //actual action against each. String actualActionName = ServletRequestUtils.getStringParameter(request, paramName + "_" + rdId + "_actualaction"); if (StringUtils.equalsIgnoreCase(ReportDefinitionWrapper.ActionType.AMEND.name(), actualActionName)) { reviewResult.getAmendList().add(rdMap.get(rdId)); //special case, amend with itself if (ArrayUtils.contains(selectedRdIds, rdId)) { reviewResult.getCreateList().add(rdMap.get(rdId)); } } if (StringUtils.equalsIgnoreCase(ReportDefinitionWrapper.ActionType.WITHDRAW.name(), actualActionName)) { reviewResult.getWithdrawList().add(rdMap.get(rdId)); } if (StringUtils.equalsIgnoreCase(ReportDefinitionWrapper.ActionType.EDIT.name(), actualActionName)) { reviewResult.getEditList().add(rdMap.get(rdId)); } if (StringUtils.equalsIgnoreCase(ReportDefinitionWrapper.ActionType.CREATE.name(), actualActionName)) { reviewResult.getCreateList().add(rdMap.get(rdId)); } } //now find the ae's selected. int[] aeIds = ServletRequestUtils.getIntParameters(request, "ae_" + aeReportId); for (int aeId : aeIds) { reviewResult.getAeList().add(aeId); } //find primaryAE Integer primaryAEId = ServletRequestUtils.getIntParameter(request, "ae_" + aeReportId + "_primary"); reviewResult.setPrimaryAdverseEventId(primaryAEId); //find the aes, deselected. for (AdverseEvent ae : command.getEvaluationResult().getAllAeMap().get(aeReportId)) { if (ArrayUtils.contains(aeIds, ae.getId().intValue())) continue; reviewResult.getUnwantedAEList().add(ae.getId()); } } catch (ServletRequestBindingException e) { log.warn( "Error while binding review-and-report page parameters, this is okay sometimes as we click back from reivew page", e); } }
From source file:com.sfs.whichdoctor.dao.SearchIndexDAOImpl.java
/** * Update the current balance index for the supplied guid/type combination. * * @param guid the guid/*from w ww . java2s .c om*/ * @param type the type * * @return true, if successful * * @throws WhichDoctorDaoException the which doctor dao exception */ public final boolean updateCurrentBalanceIndex(final int guid, final String type) throws WhichDoctorDaoException { boolean success = false; FinancialSummaryBean search = new FinancialSummaryBean(); search.setLimit(1); search.setRequestedPage(1); search.setClosingDate(Calendar.getInstance().getTime()); boolean performSearch = false; if (StringUtils.equalsIgnoreCase(type, "person")) { try { PersonBean person = this.personDAO.loadGUID(guid); search.addPerson(person); performSearch = true; } catch (WhichDoctorDaoException wde) { dataLogger.error("Error loading person: " + wde.getMessage()); } } if (StringUtils.equalsIgnoreCase(type, "organisation")) { try { OrganisationBean org = this.organisationDAO.loadGUID(guid); search.addOrganisation(org); performSearch = true; } catch (WhichDoctorDaoException wde) { dataLogger.error("Error loading organisation: " + wde.getMessage()); } } if (performSearch) { // A person or organisation has been added, perform search FinancialSummaryBean results = null; try { results = this.financialSummaryAnalysisDAO.search(search); } catch (WhichDoctorAnalysisDaoException wdae) { dataLogger.error("Error loading financial summary results: " + wdae.getMessage()); } if (results != null) { // A result was returned, update the index success = this.update(guid, "Current Balance", 0, 0, results.getClosingBalance()); } } return success; }
From source file:com.alibaba.otter.node.etl.extract.extractor.GroupExtractor.java
private void groupFilter(EventData eventData, ColumnGroup columnGroup) { List<EventColumn> addColumns = new ArrayList<EventColumn>(); // ??/*from w w w . ja v a 2s.co m*/ Set<String> updatedColumns = new HashSet<String>(); Set<String> pks = new HashSet<String>(); // ????? for (EventColumn column : eventData.getUpdatedColumns()) { updatedColumns.add(column.getColumnName()); } for (EventColumn pk : eventData.getKeys()) { pks.add(pk.getColumnName()); } if (!CollectionUtils.isEmpty(eventData.getOldKeys())) {// ?? int i = 0; for (EventColumn pk : eventData.getKeys()) { if (!StringUtils.equals(pk.getColumnValue(), eventData.getOldKeys().get(i).getColumnValue())) { updatedColumns.add(pk.getColumnName()); } i++; } } if (containsInGroupColumn(updatedColumns, columnGroup.getColumnPairs())) {// // ?+? group? for (ColumnPair columnPair : columnGroup.getColumnPairs()) { boolean groupColumnHasInChangedColunms = false;// ???? // add by ljh at 2012-11-04 // ? // 1. select??FileResolver? // 2. groupupdate=trueGroup?before??????? // columns??updateColumns // for (String columnName : updatedColumns) { for (EventColumn column : eventData.getColumns()) { if (StringUtils.equalsIgnoreCase(columnPair.getSourceColumn().getName(), column.getColumnName())) { groupColumnHasInChangedColunms = true; if (!column.isUpdate()) {// ??update=true?? column.setUpdate(true); } break; } } if (!groupColumnHasInChangedColunms) {// ?? String columnName = columnPair.getSourceColumn().getName(); if (!pks.contains(columnName)) { // ????column???? EventColumn addColumn = new EventColumn(); addColumn.setColumnName(columnPair.getSourceColumn().getName()); addColumn.setUpdate(true); addColumns.add(addColumn); } } } if (!CollectionUtils.isEmpty(addColumns)) { // ? eventData.getColumns().addAll(addColumns);// ? eventData.setSyncConsistency(SyncConsistency.MEDIA); return; } } }
From source file:com.iorga.webappwatcher.watcher.RetentionLogWritingWatcher.java
protected void sendMailForEvent(final RetentionLogWritingEvent event) { log.info("Trying to send a mail for event " + event); new Thread(new Runnable() { @Override/*from w w w . j av a 2 s . c om*/ public void run() { if (StringUtils.isEmpty(getMailSmtpHost()) || getMailSmtpPort() == null) { // no configuration defined, exiting log.error("Either SMTP host or port was not defined, not sending that mail"); return; } // example from http://www.mkyong.com/java/javamail-api-sending-email-via-gmail-smtp-example/ final Properties props = new Properties(); props.put("mail.smtp.host", getMailSmtpHost()); props.put("mail.smtp.port", getMailSmtpPort()); final Boolean auth = getMailSmtpAuth(); Authenticator authenticator = null; if (BooleanUtils.isTrue(auth)) { props.put("mail.smtp.auth", "true"); authenticator = new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(getMailSmtpUsername(), getMailSmtpPassword()); } }; } if (StringUtils.equalsIgnoreCase(getMailSmtpSecurityType(), "SSL")) { props.put("mail.smtp.socketFactory.port", getMailSmtpPort()); props.put("mail.smtp.socketFactory.class", "javax.net.ssl.SSLSocketFactory"); } else if (StringUtils.equalsIgnoreCase(getMailSmtpSecurityType(), "TLS")) { props.put("mail.smtp.starttls.enable", "true"); } final Session session = Session.getDefaultInstance(props, authenticator); try { final MimeMessage message = new MimeMessage(session); message.setFrom(new InternetAddress(getMailFrom())); message.setRecipients(RecipientType.TO, InternetAddress.parse(getMailTo())); message.setSubject(event.getReason()); if (event.getContext() != null) { final StringBuilder contextText = new StringBuilder(); for (final Entry<String, Object> contextEntry : event.getContext().entrySet()) { contextText.append(contextEntry.getKey()).append(" = ").append(contextEntry.getValue()) .append("\n"); } message.setText(contextText.toString()); } else { message.setText("Context null"); } Transport.send(message); } catch (final MessagingException e) { log.error("Problem while sending a mail", e); } } }, RetentionLogWritingWatcher.class.getSimpleName() + ":sendMailer").start(); // send mail in an async way }
From source file:com.eucalyptus.objectstorage.auth.OsgAuthorizationHandler.java
/** * Evaluates the authorization for the operation requested, evaluates IAM, ACL, and bucket policy (bucket policy not yet supported). * //from www . j ava 2s . c o m * @param request * @param bucketResourceEntity * @param objectResourceEntity * @param resourceAllocationSize the size for the quota check(s) if applicable * @return true if authorized */ public <T extends ObjectStorageRequestType> boolean operationAllowed(@Nonnull T request, @Nullable final Bucket bucketResourceEntity, @Nullable final ObjectEntity objectResourceEntity, long resourceAllocationSize) throws IllegalArgumentException { /* * Process the operation's authz requirements based on the request type annotations */ Ats requestAuthzProperties = Ats.from(request); ObjectStorageProperties.Permission[] requiredBucketACLPermissions = null; ObjectStorageProperties.Permission[] requiredObjectACLPermissions = null; boolean allowOwnerOnly = true; ObjectStorageProperties.Resource[] requiredOwnerOf = null; RequiresACLPermission requiredACLs = requestAuthzProperties.get(RequiresACLPermission.class); if (requiredACLs != null) { requiredBucketACLPermissions = requiredACLs.bucket(); requiredObjectACLPermissions = requiredACLs.object(); requiredOwnerOf = requiredACLs.ownerOf(); allowOwnerOnly = requiredOwnerOf.length > 0; } else { // No ACL annotation is ok, maybe a admin only op } String[] requiredActions = null; RequiresPermission perms = requestAuthzProperties.get(RequiresPermission.class); if (perms != null) { // check for version specific IAM permissions and version Id in the request if (perms.version().length > 0 && StringUtils.isNotBlank(request.getVersionId()) && !StringUtils .equalsIgnoreCase(request.getVersionId(), ObjectStorageProperties.NULL_VERSION_ID)) { requiredActions = perms.version(); // Use version specific IAM perms } else { requiredActions = perms.standard(); // Use default/standard IAM perms } } Boolean allowAdmin = (requestAuthzProperties.get(AdminOverrideAllowed.class) != null); // Must have at least one of: admin-only, owner-only, ACL, or IAM. if (requiredBucketACLPermissions == null && requiredObjectACLPermissions == null && requiredActions == null && !allowAdmin) { // Insufficient permission set on the message type. LOG.error("Insufficient permission annotations on type: " + request.getClass().getName() + " cannot evaluate authorization"); return false; } String resourceType = null; if (requestAuthzProperties.get(ResourceType.class) != null) { resourceType = requestAuthzProperties.get(ResourceType.class).value(); } // Get user from context final UserPrincipal requestUser; final String requestAccountNumber; final String requestCanonicalId; final AuthContextSupplier authContext; try { final Context ctx = Contexts.lookup(request.getCorrelationId()); requestUser = ctx.getUser(); requestAccountNumber = ctx.getAccountNumber(); requestCanonicalId = requestUser.getCanonicalId(); authContext = ctx.getAuthContext(); } catch (final NoSuchContextException e) { LOG.error("Context not found, cannot evaluate authorization " + request.getCorrelationId()); return false; } if (allowAdmin && requestUser.isSystemAdmin()) { // Admin override return true; } final Option<Tuple4<String, String, Integer, String>> bucketPolicy; final String resourceOwnerAccountNumber; final String bucketOwnerAccountNumber; final PolicyResourceInfo<S3AccessControlledEntity> policyResourceInfo; if (resourceType == null) { LOG.error("No resource type found in request class annotations, cannot process."); return false; } else { try { // Ensure we have the proper resource entities present and get owner info switch (resourceType) { case S3PolicySpec.S3_RESOURCE_BUCKET: // Get the bucket owner. bucket and resource owner are same in this case if (bucketResourceEntity == null) { LOG.error("Could not check access for operation due to no bucket resource entity found"); return false; } else { bucketOwnerAccountNumber = resourceOwnerAccountNumber = lookupAccountIdByCanonicalId( bucketResourceEntity.getOwnerCanonicalId()); policyResourceInfo = PolicyResourceContext.resourceInfo(resourceOwnerAccountNumber, bucketResourceEntity); bucketPolicy = Option .of(Tuple.of(bucketOwnerAccountNumber, bucketResourceEntity.getBucketName(), bucketResourceEntity.getVersion(), bucketResourceEntity.getPolicy())); } break; case S3PolicySpec.S3_RESOURCE_OBJECT: // get the bucket owner account number as the bucket and object owner may be different if (bucketResourceEntity == null) { // cannot be null as every object is associated with one bucket LOG.error("Could not check access for operation due to no bucket resource entity found"); return false; } else { bucketOwnerAccountNumber = lookupAccountIdByCanonicalId( bucketResourceEntity.getOwnerCanonicalId()); bucketPolicy = Option .of(Tuple.of(bucketOwnerAccountNumber, bucketResourceEntity.getBucketName(), bucketResourceEntity.getVersion(), bucketResourceEntity.getPolicy())); } // get the object owner. if (objectResourceEntity == null) { LOG.error("Could not check access for operation due to no object resource entity found"); return false; } else { // on create treat the object owner as the bucket owner for authorization purposes resourceOwnerAccountNumber = ObjectState.creating == objectResourceEntity.getState() ? bucketOwnerAccountNumber : lookupAccountIdByCanonicalId(objectResourceEntity.getOwnerCanonicalId()); policyResourceInfo = PolicyResourceContext.resourceInfo(resourceOwnerAccountNumber, objectResourceEntity); } break; default: LOG.error("Unknown resource type looking up resource owner. Disallowing operation."); return false; } } catch (AuthException e) { LOG.error("Exception caught looking up resource owner. Disallowing operation.", e); return false; } } // Get the resourceId based on IAM resource type final String resourceId; if (S3PolicySpec.S3_RESOURCE_BUCKET.equals(resourceType)) { resourceId = request.getBucket(); } else if (S3PolicySpec.S3_RESOURCE_OBJECT.equals(resourceType)) { resourceId = request.getFullResource(); } else { resourceId = null; } // Override for 'eucalyptus' account and workaround for EUCA-11346 // Skip ACL checks for 'eucalyptus' account only. ACL checks must be performed for all other accounts including system accounts // IAM checks must be performed for all accounts if (allowAdmin && AccountIdentifiers.SYSTEM_ACCOUNT.equals(requestUser.getAccountAlias())) { return iamPermissionsAllow(true, authContext, requiredActions, policyResourceInfo, Option.none(), resourceType, resourceId, resourceAllocationSize); } // Don't allow anonymous to create buckets. EUCA-12902 if (S3PolicySpec.S3_RESOURCE_BUCKET.equals(resourceType) && Principals.nobodyAccount().getAccountNumber().equals(resourceOwnerAccountNumber) && request instanceof CreateBucketType) { return false; } if (requiredBucketACLPermissions == null) { throw new IllegalArgumentException( "No requires-permission actions found in request class annotations, cannot process."); } /* * Bucket or object owner only? It is expected that ownerOnly flag can be used solely or in combination with ACL checks. If owner checks are * required, evaluate them first before evaluating the ACLs */ Boolean isRequestByOwner = false; if (allowOwnerOnly) { // owner checks are in effect if (requiredOwnerOf == null || requiredOwnerOf.length == 0) { LOG.error( "Owner only flag does not include resource (bucket, object) that ownership checks should be applied to"); return false; } for (ObjectStorageProperties.Resource resource : requiredOwnerOf) { if (ObjectStorageProperties.Resource.bucket.equals(resource)) { isRequestByOwner = isRequestByOwner || bucketOwnerAccountNumber.equals(requestAccountNumber); } else { isRequestByOwner = isRequestByOwner || resourceOwnerAccountNumber.equals(requestAccountNumber); } } if (!isRequestByOwner) { LOG.debug("Request is rejected by ACL checks due to account ownership requirements"); return false; } } else { // owner check does not apply } final boolean requestAccountIsResourceAccount = // so request account iam policy is sufficient to grant access isRequestByOwner || ((S3PolicySpec.S3_RESOURCE_OBJECT.equals(resourceType) || S3PolicySpec.S3_RESOURCE_BUCKET.equals(resourceType)) && resourceOwnerAccountNumber.equals(requestAccountNumber)); final boolean bucketAccountIsObjectAccount = // so bucket policy is sufficient to grant access S3PolicySpec.S3_RESOURCE_OBJECT.equals(resourceType) && resourceOwnerAccountNumber.equals(bucketOwnerAccountNumber); /* ACL Checks: Is the user's account allowed? */ Boolean aclAllow = false; if (requiredBucketACLPermissions.length > 0 || requiredObjectACLPermissions.length > 0) { // check ACLs if any // Check bucket ACLs, if any if (requiredBucketACLPermissions.length > 0) { // Evaluate the bucket ACL, any matching grant gives permission for (ObjectStorageProperties.Permission permission : requiredBucketACLPermissions) { aclAllow = aclAllow || bucketResourceEntity.can(permission, requestCanonicalId); } } // Check object ACLs, if any if (requiredObjectACLPermissions != null && requiredObjectACLPermissions.length > 0) { if (objectResourceEntity == null) { // There are object ACL requirements but no object entity to check. fail. // Don't bother with other checks, this is an invalid state LOG.error("Null bucket resource, cannot evaluate bucket ACL"); return false; } for (ObjectStorageProperties.Permission permission : requiredObjectACLPermissions) { aclAllow = aclAllow || objectResourceEntity.can(permission, requestCanonicalId); } } } else { // No ACLs, ownership would have been used to determine privilege aclAllow = isRequestByOwner; } final Boolean iamAllow = iamPermissionsAllow(aclAllow, authContext, requiredActions, policyResourceInfo, bucketPolicy, resourceType, resourceId, resourceAllocationSize); // Must have both acl and iam allow (account & user) return (aclAllow || bucketAccountIsObjectAccount || requestAccountIsResourceAccount) && iamAllow; }
From source file:net.sf.sze.frontend.zeugnis.SchulamtsBemerkungController.java
/** * Speichert die neu angelegte Bemerkung. * @param halbjahrId die Id des Schulhalbjahres * @param klassenId die Id der Klasse/*from w w w . ja v a2 s .c om*/ * @param schuelerId die Id des Schuelers * @param schulamtsBemerkung die Schulamtsbemerkung. * @param action die als nchstes auszufhrende Aktion. * @param model das Model * @param result das Bindingresult. * @return die logische View */ @RequestMapping(value = URL.ZeugnisPath.SCHULAMTS_BEMERKUNG_CREATE, method = RequestMethod.POST) public String insertSchulamtsBemerkung(@PathVariable(URL.Session.P_HALBJAHR_ID) Long halbjahrId, @PathVariable(URL.Session.P_KLASSEN_ID) Long klassenId, @PathVariable(URL.Session.P_SCHUELER_ID) Long schuelerId, @ModelAttribute("schulamtsBemerkung") SchulamtsBemerkung schulamtsBemerkung, BindingResult result, @RequestParam(value = URL.Common.P_ACTION, required = false) String action, Model model) { validator.validate(schulamtsBemerkung, result); if (result.hasErrors()) { LOG.info("Fehler beim Speichern der Schulamtsbemerkung: {}", result.getAllErrors()); model.addAttribute("insertUrl", URL.filledURLWithNamedParams(URL.ZeugnisPath.SCHULAMTS_BEMERKUNG_CREATE, URL.Session.P_HALBJAHR_ID, halbjahrId, URL.Session.P_KLASSEN_ID, klassenId, URL.Session.P_SCHUELER_ID, schuelerId)); fillModel(model, halbjahrId, klassenId, schuelerId, schulamtsBemerkung); return EDIT_SCHULAMTS_BEMERKUNG_VIEW; } LOG.debug("Create Bemerkung: " + schulamtsBemerkung); schulamtsBemerkungService.save(schulamtsBemerkung); final String nextUrl; if (StringUtils.equalsIgnoreCase(action, Common.ACTION_NEXT)) { nextUrl = URL.redirectWithNamedParams(URL.ZeugnisPath.SCHULAMTS_BEMERKUNG_CREATE, URL.Session.P_HALBJAHR_ID, halbjahrId, URL.Session.P_KLASSEN_ID, klassenId, URL.Session.P_SCHUELER_ID, schuelerId); } else { nextUrl = URL.createRedirectToZeugnisUrl(halbjahrId, klassenId, schuelerId); } return nextUrl; }