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:info.magnolia.cms.security.MgnlUser.java
/** * removed node/*from w ww . j av a2 s. c om*/ * @param name * @param nodeName */ private void remove(String name, String nodeName) { try { HierarchyManager hm; if (StringUtils.equalsIgnoreCase(nodeName, NODE_ROLES)) hm = MgnlContext.getHierarchyManager(ContentRepository.USER_ROLES); else hm = MgnlContext.getHierarchyManager(ContentRepository.USER_GROUPS); Content node = userNode.getContent(nodeName); for (Iterator iter = node.getNodeDataCollection().iterator(); iter.hasNext();) { NodeData nodeData = (NodeData) iter.next(); // check for the existence of this ID try { if (hm.getContentByUUID(nodeData.getString()).getName().equalsIgnoreCase(name)) { nodeData.delete(); } } catch (ItemNotFoundException e) { if (log.isDebugEnabled()) log.debug("Role [ " + name + " ] does not exist in the ROLES repository"); } catch (IllegalArgumentException e) { if (log.isDebugEnabled()) log.debug(nodeData.getHandle() + " has invalid value"); } } userNode.save(); } catch (RepositoryException e) { log.error("failed to remove " + name + " from user [" + this.getName() + "]", e); } }
From source file:net.sf.sze.frontend.zeugnis.BemerkungController.java
/** * Speichert die neu angelegte Bemerkung. * @param halbjahrId die Id des Schulhalbjahres * @param klassenId die Id der Klasse//w w w .j a va2 s. com * @param schuelerId die Id des Schuelers * @param bemerkung die zu speichernde Bemerkung. * @param action die als nchstes auszufhrende Aktion. * @param model das Model * @param result das Bindingresult. * @return die logische View */ @RequestMapping(value = URL.ZeugnisPath.BEMERKUNG_CREATE, method = RequestMethod.POST) public String insertBemerkung(@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(BEMERKUNG) Bemerkung bemerkung, @RequestParam(value = URL.Common.P_ACTION, required = false) String action, BindingResult result, Model model) { validator.validate(bemerkung, result); if (result.hasErrors()) { model.addAttribute("insertUrl", URL.filledURLWithNamedParams(URL.ZeugnisPath.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, bemerkung); return EDIT_BEMERKUNG_VIEW; } LOG.debug("Create Bemerkung: " + bemerkung); bemerkungService.save(bemerkung); final String nextUrl; if (StringUtils.equalsIgnoreCase(action, Common.ACTION_NEXT)) { nextUrl = URL.redirectWithNamedParams(URL.ZeugnisPath.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; }
From source file:com.qualogy.qafe.business.integration.rdb.SQLQueryDAO.java
/** * check if given input param has a equal column name in the given table * * @param tableColumns/*from w w w . j ava 2s . com*/ * @param columnName * @return */ private boolean inputParamIsAColumnInGiveTable(Set<String> tableColumns, String columnName) { String colName = ""; Iterator<String> iterator = tableColumns.iterator(); while (iterator.hasNext()) { colName = iterator.next(); if (StringUtils.equalsIgnoreCase(colName, columnName)) { return true; } } return false; }
From source file:edu.ku.kuali.kra.timeandmoney.service.impl.TimeAndMoneyHistoryServiceImpl.java
@SuppressWarnings("unchecked") public void getTimeAndMoneyHistory(String awardNumber, Map<Object, Object> timeAndMoneyHistory, List<Integer> columnSpan) throws WorkflowException { Map<String, Object> fieldValues1 = new HashMap<String, Object>(); Map<String, Object> fieldValues3 = new HashMap<String, Object>(); Map<String, Object> fieldValues3a = new HashMap<String, Object>(); Map<String, Object> fieldValues5 = new HashMap<String, Object>(); Map<String, Object> fieldValues4 = new HashMap<String, Object>(); AwardAmountTransaction awardAmountTransaction = null; timeAndMoneyHistory.clear();/*from w ww . j av a 2 s. c o m*/ Award award = awardVersionService.getWorkingAwardVersion(awardNumber); List<TimeAndMoneyDocument> docs = null; int key = 150; int j = -1; award.refreshReferenceObject("awardDocument"); // to get all docs, we must pass the root award number for the subject award. fieldValues1.put("rootAwardNumber", getRootAwardNumberForDocumentSearch(award.getAwardNumber())); docs = (List<TimeAndMoneyDocument>) businessObjectService.findMatching(TimeAndMoneyDocument.class, fieldValues1); Collections.sort(docs); timeAndMoneyHistory.put(buildForwardUrl(award.getAwardDocument().getDocumentNumber()), award.getAwardDescriptionLine()); for (TimeAndMoneyDocument tempDoc : docs) { TimeAndMoneyDocument doc = (TimeAndMoneyDocument) documentService .getByDocumentHeaderId(tempDoc.getDocumentNumber()); List<AwardAmountTransaction> awardAmountTransactions = doc.getAwardAmountTransactions(); // we don't want canceled docs in history. if (doc.getDocumentHeader().hasWorkflowDocument()) { if (!doc.getDocumentHeader().getWorkflowDocument().isCanceled()) { // capture initial transaction // we only want display this once. for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) { if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) { if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) { if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(), awardAmountInfo.getTimeAndMoneyDocumentNumber())) { if (awardAmountTransactions.size() > 0) { awardAmountTransaction = awardAmountTransactions.get(0); timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()), award.getAwardDescriptionLine()); } fieldValues5.put("destinationAwardNumber", awardAmountInfo.getAwardNumber()); fieldValues5.put("transactionId", 0); fieldValues5.put("timeAndMoneyDocumentNumber", awardAmountInfo.getTimeAndMoneyDocumentNumber()); fieldValues5.put("transactionDetailType", TransactionDetailType.PRIMARY.toString()); List<TransactionDetail> transactionDetailsA = ((List<TransactionDetail>) businessObjectService .findMatchingOrderBy(TransactionDetail.class, fieldValues5, "sourceAwardNumber", true)); if (transactionDetailsA.size() > 0) { TransactionDetail transactionDetail = transactionDetailsA.get(0); timeAndMoneyHistory.put(0, awardAmountInfo); timeAndMoneyHistory.put(key, transactionDetail); key++; break; } else { break; } } } } } // capture money transactions for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) { if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) { if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) { if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(), awardAmountInfo.getTimeAndMoneyDocumentNumber())) { if (awardAmountTransactions.size() > 0) { awardAmountTransaction = awardAmountTransactions.get(0); timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()), award.getAwardDescriptionLine()); } List<TransactionDetail> transactionDetails = new ArrayList<TransactionDetail>(); // get all Transaction Details for a node. It can be the source or a destination of the transaction. fieldValues3.put("sourceAwardNumber", awardAmountInfo.getAwardNumber()); fieldValues3.put("transactionId", awardAmountInfo.getTransactionId()); fieldValues3.put("timeAndMoneyDocumentNumber", awardAmountInfo.getTimeAndMoneyDocumentNumber()); fieldValues5.put("transactionDetailType", TransactionDetailType.PRIMARY.toString()); fieldValues3a.put("destinationAwardNumber", awardAmountInfo.getAwardNumber()); fieldValues3a.put("transactionId", awardAmountInfo.getTransactionId()); fieldValues3a.put("timeAndMoneyDocumentNumber", awardAmountInfo.getTimeAndMoneyDocumentNumber()); fieldValues5.put("transactionDetailType", TransactionDetailType.PRIMARY.toString()); // should only return one transaction detail because we are making transaction ID unique when we set // to Pending Transaction ID in ActivePendingTransactionService. List<TransactionDetail> transactionDetailsA = ((List<TransactionDetail>) businessObjectService .findMatchingOrderBy(TransactionDetail.class, fieldValues3, "sourceAwardNumber", true)); List<TransactionDetail> transactionDetailsB = ((List<TransactionDetail>) businessObjectService .findMatchingOrderBy(TransactionDetail.class, fieldValues3a, "sourceAwardNumber", true)); transactionDetails.addAll(transactionDetailsA); transactionDetails.addAll(transactionDetailsB); int i = 0; for (TransactionDetail transactionDetail : transactionDetails) { timeAndMoneyHistory.put(awardAmountInfo.getTransactionId(), awardAmountInfo); timeAndMoneyHistory.put(key, transactionDetail); key++; i++; } columnSpan.add(i); } } } } } } // capture date transactions for (AwardAmountInfo awardAmountInfo : award.getAwardAmountInfos()) { if (!(awardAmountInfo.getTimeAndMoneyDocumentNumber() == null)) { if (awardAmountInfo.getTimeAndMoneyDocumentNumber().equals(doc.getDocumentNumber())) { if (StringUtils.equalsIgnoreCase(doc.getDocumentNumber(), awardAmountInfo.getTimeAndMoneyDocumentNumber())) { if (awardAmountInfo.getTransactionId() == null) { if (awardAmountTransactions.size() > 0) { awardAmountTransaction = awardAmountTransactions.get(0); timeAndMoneyHistory.put(buildForwardUrl(doc.getDocumentNumber()), award.getAwardDescriptionLine()); } fieldValues4.put("sourceAwardNumber", awardAmountInfo.getAwardNumber()); fieldValues4.put("transactionId", "-1"); fieldValues4.put("timeAndMoneyDocumentNumber", awardAmountInfo.getTimeAndMoneyDocumentNumber()); fieldValues5.put("transactionDetailType", TransactionDetailType.PRIMARY.toString()); // Can return multiple transaction details because we are defaulting the transaction ID to -1 // in Date change transactions. List<TransactionDetail> dateTransactionDetails = ((List<TransactionDetail>) businessObjectService .findMatchingOrderBy(TransactionDetail.class, fieldValues4, "sourceAwardNumber", true)); int i = 0; for (TransactionDetail transactionDetail : dateTransactionDetails) { timeAndMoneyHistory.put(j, awardAmountInfo);// this is just for display only. timeAndMoneyHistory.put(key, transactionDetail); key++; i++; j--;// Map enforces unique key when adding to timeAndMoneyHistory. Must be negative so it does not conflict with // transaction ID of money transactions. } columnSpan.add(i); break; } } } } } } }
From source file:com.sfs.whichdoctor.dao.ExamDAOImpl.java
/** * Calculate exam deadline.//w w w .j a v a2 s . c o m * * @param exams the exams * @return the date */ public final java.util.Date calculateExamDeadline(final Collection<ExamBean> exams) { java.util.Date identifiedExamDeadline = null; if (exams != null && this.examDeadline > 0) { boolean examPassed = false; for (ExamBean exam : exams) { if (!examPassed && exam != null) { if (StringUtils.equalsIgnoreCase(exam.getType(), "Written Exam") && StringUtils.equalsIgnoreCase(exam.getStatus(), "Passed")) { /* Written exam passed - set exam deadline */ Calendar calendar = Calendar.getInstance(); calendar.setTime(exam.getDateSat()); calendar.add(Calendar.DATE, this.examDeadline); identifiedExamDeadline = calendar.getTime(); } else { if (StringUtils.equalsIgnoreCase(exam.getStatus(), "Passed")) { // Non-written exam passed - set exam passed examPassed = true; identifiedExamDeadline = null; } if (StringUtils.equalsIgnoreCase(exam.getStatus(), "Deferred")) { // Non-written exam deferred - redefine exam deadline Calendar calendar = Calendar.getInstance(); calendar.setTime(identifiedExamDeadline); calendar.add(Calendar.DATE, DAYS_IN_YEAR); identifiedExamDeadline = calendar.getTime(); } } } } } return identifiedExamDeadline; }
From source file:com.hangum.tadpole.rdb.core.dialog.export.sqltoapplication.composites.axisj.AxisjComposite.java
/** * Create the composite./* w w w . j a v a 2s .c o m*/ * @param parent * @param style */ public AxisjComposite(Composite tabFolderObject, UserDBDAO userDB, String strTitle, final String sql, EditorDefine.SQL_TO_APPLICATION type) { super(tabFolderObject, SWT.NONE, userDB, sql, type); CTabItem tbtmTable = new CTabItem((CTabFolder) tabFolderObject, SWT.NONE); tbtmTable.setText(strTitle); tbtmTable.setData(type); Composite compositeBody = new Composite(tabFolderObject, SWT.NONE); tbtmTable.setControl(compositeBody); compositeBody.setLayout(new GridLayout(1, false)); compositeBody.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); Composite compositeTitle = new Composite(compositeBody, SWT.NONE); compositeTitle.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); compositeTitle.setLayout(new GridLayout(4, false)); Label lblVariable = new Label(compositeTitle, SWT.NONE); lblVariable.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblVariable.setText(Messages.get().Variable); slt = new SQLToLanguageConvert(userDB, type); textVariable = new Text(compositeTitle, SWT.BORDER); textVariable.setToolTipText("Target DIV ID"); textVariable.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); textVariable.setText(slt.getDefaultVariable()); Button btnConvertSQL = new Button(compositeTitle, SWT.NONE); btnConvertSQL.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { sqlToStr(); if (StringUtils.equalsIgnoreCase("Browser", tabFolder.getSelection().getText())) { refreshBrowser(); } } }); btnConvertSQL.setText(String.format(Messages.get().SQLToStringDialog_btnNewButton_text, type)); Button btnOriginalText = new Button(compositeTitle, SWT.NONE); btnOriginalText.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { textConvert.setText(sql); tabFolder.setSelection(0); } }); btnOriginalText.setText(Messages.get().SQLToStringDialog_4); Composite composite = new Composite(compositeBody, SWT.NONE); composite.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); composite.setLayout(new GridLayout(6, false)); Label lblTheme = new Label(composite, SWT.NONE); lblTheme.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblTheme.setText("Theme"); textTheme = new Text(composite, SWT.BORDER); textTheme.setText("AXGrid"); textTheme.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false, 1, 1)); Label lblNewLabel = new Label(composite, SWT.NONE); lblNewLabel.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel.setText("Fixed Column"); spinnerFixedCol = new Spinner(composite, SWT.BORDER); Label lblFitToWidth = new Label(composite, SWT.NONE); lblFitToWidth.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblFitToWidth.setText("Fit to Width"); btnCheckFit2Width = new Button(composite, SWT.CHECK); btnCheckFit2Width.setSelection(true); Label lblHeaderAlign = new Label(composite, SWT.NONE); lblHeaderAlign.setAlignment(SWT.RIGHT); lblHeaderAlign.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblHeaderAlign.setText("Header Align"); comboHeadAlign = new CCombo(composite, SWT.BORDER); comboHeadAlign.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboHeadAlign.setItems(new String[] { "Left", "Center", "Right" }); comboHeadAlign.setText("Center"); comboHeadAlign.setEditable(false); Label lblNewLabel_1 = new Label(composite, SWT.NONE); lblNewLabel_1.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_1.setText("Merge Cells"); comboMergeCell = new CCombo(composite, SWT.BORDER); comboMergeCell.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboMergeCell.setItems(new String[] { "True", "False" }); comboMergeCell.setText("False"); Label lblNewLabel_2 = new Label(composite, SWT.NONE); lblNewLabel_2.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_2.setText("Grid Height"); comboHeight = new CCombo(composite, SWT.BORDER); comboHeight.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboHeight.setItems(new String[] { "Auto", "300", "500", "600", "800" }); comboHeight.setText("500"); Label lblSort = new Label(composite, SWT.NONE); lblSort.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblSort.setAlignment(SWT.RIGHT); lblSort.setText("Sort"); comboSort = new CCombo(composite, SWT.BORDER); comboSort.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboSort.setItems(new String[] { "True", "False" }); comboSort.setText("True"); comboSort.setEditable(false); Label lblNewLabel_3 = new Label(composite, SWT.NONE); lblNewLabel_3.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, true, false, 1, 1)); lblNewLabel_3.setText("Head Tool"); comboHeadTool = new CCombo(composite, SWT.BORDER); comboHeadTool.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboHeadTool.setItems(new String[] { "True", "False" }); comboHeadTool.setText("True"); comboHeadTool.setEditable(false); Label lblNewLabel_4 = new Label(composite, SWT.NONE); lblNewLabel_4.setLayoutData(new GridData(SWT.RIGHT, SWT.CENTER, false, false, 1, 1)); lblNewLabel_4.setText("View Mode"); comboViewMode = new CCombo(composite, SWT.BORDER); comboViewMode.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, false, false, 1, 1)); comboViewMode.setItems(new String[] { "Grid", "Icon", "Mobile" }); comboViewMode.setText("Grid"); comboViewMode.setEditable(false); SashForm sashForm = new SashForm(compositeBody, SWT.VERTICAL); sashForm.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); tableViewer = new TableViewer(sashForm, SWT.BORDER | SWT.FULL_SELECTION /* | SWT.VIRTUAL */); Table table = tableViewer.getTable(); table.setHeaderVisible(true); table.setLinesVisible(true); createTaleColumn(); tableViewer.setContentProvider(new ArrayContentProvider()); tableViewer.setLabelProvider(new AxisJLabelProvider()); tableViewer.setInput(listAxisjHeader); this.listAxisjHeader = SQLToAxisjConvert.initializeHead(listAxisjHeader, this.userDB, this.sql); tableViewer.refresh(); tabFolder = new CTabFolder(sashForm, SWT.BORDER | SWT.BOTTOM); tabFolder.addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { // selected preview if (tabFolder.getSelectionIndex() == 1) { refreshBrowser(); } } }); tabFolder.setSelectionBackground( Display.getCurrent().getSystemColor(SWT.COLOR_TITLE_INACTIVE_BACKGROUND_GRADIENT)); tabFolder.setSelectionBackground(TadpoleWidgetUtils.getTabFolderBackgroundColor(), TadpoleWidgetUtils.getTabFolderPercents()); CTabItem tbtmHtml = new CTabItem(tabFolder, SWT.NONE); tbtmHtml.setText("HTML"); textConvert = new Text(tabFolder, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL | SWT.CANCEL); tbtmHtml.setControl(textConvert); textConvert.setLayoutData(new GridData(SWT.FILL, SWT.FILL, true, true, 1, 1)); CTabItem tabBrowser = new CTabItem(tabFolder, SWT.NONE); tabBrowser.setText("Browser"); browserPreview = new Browser(tabFolder, SWT.NONE | SWT.H_SCROLL | SWT.V_SCROLL); tabBrowser.setControl(browserPreview); tabFolder.setSelection(0); sqlToStr(); sashForm.setWeights(new int[] { 4, 5 }); }
From source file:com.spider.ssh.SshConfigFile.java
/** * Gets the host with <code>name</code> or returns null. * @param name//from www .j av a 2 s. co m * @return */ public Host getHost(String name) { for (Host h : getHosts()) { if (StringUtils.equalsIgnoreCase(name, h.getName())) { return h; } } return null; }
From source file:hydrograph.ui.propertywindow.widgets.customwidgets.PropogateWidget.java
@Override public void attachToPropertySubGroup(AbstractELTContainerWidget subGroup) { ELTDefaultSubgroupComposite eltDefaultSubgroupComposite = new ELTDefaultSubgroupComposite( subGroup.getContainerControl()); eltDefaultSubgroupComposite.createContainerWidget(); AbstractELTWidget eltDefaultLable = new ELTDefaultLable(Constants.PROPAGATE_FIELD_FROM_LEFT); eltDefaultSubgroupComposite.attachWidget(eltDefaultLable); setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl()); AbstractELTWidget eltDefaultButton;// w w w . j av a 2 s. c o m if (OSValidator.isMac()) { eltDefaultButton = new ELTDefaultButton(Constants.PROPAGATE).buttonWidth(120); } else { eltDefaultButton = new ELTDefaultButton(Constants.PROPAGATE); } eltDefaultSubgroupComposite.attachWidget(eltDefaultButton); if (getComponent().isContinuousSchemaPropogationAllow()) { if (StringUtils.equalsIgnoreCase(getComponent().getCategory(), Constants.STRAIGHTPULL) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.FILTER) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.UNIQUE_SEQUENCE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.PARTITION_BY_EXPRESSION)) { for (Link link : getComponent().getTargetConnections()) { Schema previousComponentSchema = SubjobUtility.INSTANCE .getSchemaFromPreviousComponentSchema(getComponent(), link); if (previousComponentSchema != null) { getSchemaForInternalPropagation().getGridRow().addAll(SchemaSyncUtility.INSTANCE .convertGridRowsSchemaToBasicSchemaGridRows(previousComponentSchema.getGridRow())); } if (StringUtils.equalsIgnoreCase(Constants.UNION_ALL, getComponent().getComponentName())) { break; } addUniqueSequenceFieldIfComponentIsUniqueSequence(); } } } //Call when Propogate from left button is Pressed ((Button) eltDefaultButton.getSWTWidgetControl()).addSelectionListener(new SelectionAdapter() { @Override public void widgetSelected(SelectionEvent e) { Map<String, Schema> oldSchemaMap = new TreeMap<>(); boolean shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = true; for (Link link : getComponent().getTargetConnections()) { Schema previousComponentSchema = SubjobUtility.INSTANCE .getSchemaFromPreviousComponentSchema(getComponent(), link); if (previousComponentSchema != null) { if (StringUtils.equalsIgnoreCase(getComponent().getCategory(), Constants.STRAIGHTPULL) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.FILTER) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.UNIQUE_SEQUENCE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.PARTITION_BY_EXPRESSION)) { getSchemaForInternalPropagation().getGridRow().clear(); shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = checkIfUnionAllInputDataIsSyncOrNot( shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents); if (!shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents) { break; } getSchemaForInternalPropagation().getGridRow() .addAll(SchemaSyncUtility.INSTANCE.convertGridRowsSchemaToBasicSchemaGridRows( previousComponentSchema.getGridRow())); addUniqueSequenceFieldIfComponentIsUniqueSequence(); getComponent().getProperties().put(Constants.SCHEMA_PROPERTY_NAME, getSchemaForInternalPropagation()); ELTSchemaGridWidget eltSchemaGridWidget = (ELTSchemaGridWidget) getWidget(); if (eltSchemaGridWidget != null && !getSchemaForInternalPropagation().getGridRow().isEmpty()) { eltSchemaGridWidget.refresh(); } eltSchemaGridWidget .showHideErrorSymbol(!getSchemaForInternalPropagation().getGridRow().isEmpty()); if (StringUtils.equalsIgnoreCase(Constants.UNION_ALL, getComponent().getComponentName())) break; } else if (getComponent() instanceof SubjobComponent) { Container container = (Container) getComponent().getSubJobContainer() .get(Constants.SUBJOB_CONTAINER); for (Component component : container.getUIComponentList()) { if (component instanceof InputSubjobComponent) { SubjobUtility.INSTANCE.initializeSchemaMapForInputSubJobComponent(component, getComponent()); getComponent().setContinuousSchemaPropogationAllow(true); SubjobUtility.INSTANCE.setFlagForContinuousSchemaPropogation(component); break; } } shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = !SubjobUtility.INSTANCE .checkIfSubJobHasTransformOrUnionAllComponent(getComponent()); break; } else if (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.AGGREGATE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.CUMULATE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.GROUP_COMBINE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.NORMALIZE) || StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.TRANSFORM)) { AbstractWidget transformWidget = getWidget(); TransformMapping transformMapping = (TransformMapping) transformWidget.getProperties() .get(Constants.OPERATION); InputField inputField = null; transformMapping.getInputFields().clear(); if (previousComponentSchema != null) { for (BasicSchemaGridRow row : SchemaSyncUtility.INSTANCE .convertGridRowsSchemaToBasicSchemaGridRows( previousComponentSchema.getGridRow())) { inputField = new InputField(row.getFieldName(), new ErrorObject(false, "")); transformMapping.getInputFields().add(inputField); } } if (transformMapping.isAllInputFieldsArePassthrough()) { OutputRecordCountUtility.INSTANCE.addPassThroughFieldsToSchema(transformMapping, getComponent(), getSchemaForInternalPropagation()); } else { shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = false; } } else if (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.JOIN)) { ELTJoinMapWidget joinMapWidget = (ELTJoinMapWidget) getWidget(); List<List<FilterProperties>> sorceFieldList = SchemaPropagationHelper.INSTANCE .sortedFiledNamesBySocketId(getComponent()); if (joinMapWidget != null) { JoinMappingGrid joinMappingGrid = (JoinMappingGrid) joinMapWidget.getProperties() .get(Constants.JOIN_MAP_FIELD); joinMappingGrid.setLookupInputProperties(sorceFieldList); } shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = false; } else if (StringUtils.equalsIgnoreCase(getComponent().getComponentName(), Constants.LOOKUP)) { ELTLookupMapWidget lookupMapWidget = (ELTLookupMapWidget) getWidget(); List<List<FilterProperties>> sorceFieldList = SchemaPropagationHelper.INSTANCE .sortedFiledNamesBySocketId(getComponent()); LookupMappingGrid joinMappingGrid = (LookupMappingGrid) lookupMapWidget.getProperties() .get(Constants.LOOKUP_MAP_FIELD); joinMappingGrid.setLookupInputProperties(sorceFieldList); shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = false; } } oldSchemaMap.put(link.getTargetTerminal(), previousComponentSchema); } getComponent().getProperties().put(Constants.PREVIOUS_COMPONENT_OLD_SCHEMA, oldSchemaMap); if (shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents) { SubjobUtility.INSTANCE.setFlagForContinuousSchemaPropogation(getComponent()); } showHideErrorSymbol(widgets); } private boolean checkIfUnionAllInputDataIsSyncOrNot( boolean shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents) { if (StringUtils.equalsIgnoreCase(Constants.UNION_ALL, getComponent().getComponentName())) { if (!SubjobUtility.INSTANCE.isUnionAllInputSchemaInSync(getComponent())) { shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents = false; getComponent().getProperties().put(Constants.IS_UNION_ALL_COMPONENT_SYNC, Constants.FALSE); WidgetUtility.createMessageBox(Messages.INPUTS_SCHEMA_ARE_NOT_IN_SYNC, Constants.ERROR, SWT.ICON_ERROR | SWT.OK); } else { getComponent().getProperties().put(Constants.IS_UNION_ALL_COMPONENT_SYNC, Constants.TRUE); } } return shouldsetContinuousSchemaPropagationFlagForNextConnectedComponents; } }); setPropertyHelpWidget((Control) eltDefaultLable.getSWTWidgetControl()); }
From source file:com.adobe.acs.commons.util.TypeUtil.java
/** * Converts a limited set of String representations to their corresponding Objects * <p/>//from w ww. j av a 2 s . c o m * Supports * * Double * * Long * * Integer * * Boolean (true/false) * * Dates in string format of ISODateTimeFormat * <p/> * Else, null is returned. * * @param data the String representation of the data * @param klass the target class type of the provided data * @param <T> the target class type of the provided data * @return the derived object representing the data as specified by the klass */ public static <T> T toObjectType(String data, Class<T> klass) { if (Double.class.equals(klass)) { try { return klass.cast(Double.parseDouble(data)); } catch (NumberFormatException ex) { return null; } } else if (Long.class.equals(klass)) { try { return klass.cast(Long.parseLong(data)); } catch (NumberFormatException ex) { return null; } } else if (Integer.class.equals(klass)) { try { return klass.cast(Long.parseLong(data)); } catch (NumberFormatException ex) { return null; } } else if (StringUtils.equalsIgnoreCase("true", data)) { return klass.cast(Boolean.TRUE); } else if (StringUtils.equalsIgnoreCase("false", data)) { return klass.cast(Boolean.FALSE); } else if (JSON_DATE.matcher(data).matches()) { return klass.cast(ISODateTimeFormat.dateTimeParser().parseDateTime(data).toDate()); } else { return klass.cast(data); } }
From source file:info.magnolia.cms.servlets.RequestInterceptor.java
/** * Request and Response here is same as receivced by the original page so it includes all post/get data. Sub action * could be called from here once this action finishes, it will continue loading the requested page. *//*from www. j a v a2 s.c o m*/ public void doGet(HttpServletRequest request, HttpServletResponse response) { String action = request.getParameter(EntryServlet.INTERCEPT); String repository = request.getParameter(PARAM_REPOSITORY); if (repository == null) { repository = ContentRepository.WEBSITE; } HierarchyManager hm = MgnlContext.getHierarchyManager(repository); synchronized (ExclusiveWrite.getInstance()) { if (action.equals(ACTION_PREVIEW)) { // preview mode (button in main bar) String preview = request.getParameter(Resource.MGNL_PREVIEW_ATTRIBUTE); if (preview != null) { // @todo IMPORTANT remove use of http session HttpSession httpsession = request.getSession(true); if (BooleanUtils.toBoolean(preview)) { httpsession.setAttribute(Resource.MGNL_PREVIEW_ATTRIBUTE, Boolean.TRUE); } else { httpsession.removeAttribute(Resource.MGNL_PREVIEW_ATTRIBUTE); } } } else if (action.equals(ACTION_NODE_DELETE)) { // delete paragraph try { String path = request.getParameter(PARAM_PATH); // deactivate updatePageMetaData(request, hm); hm.delete(path); hm.save(); } catch (RepositoryException e) { log.error("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$ } } else if (action.equals(ACTION_NODE_SORT)) { // sort paragrpahs try { String pathSelected = request.getParameter(PARAM_PATH_SELECTED); String pathSortAbove = request.getParameter(PARAM_PATH_SORT_ABOVE); String pathParent = StringUtils.substringBeforeLast(pathSelected, "/"); //$NON-NLS-1$ String srcName = StringUtils.substringAfterLast(pathSelected, "/"); String destName = StringUtils.substringAfterLast(pathSortAbove, "/"); if (StringUtils.equalsIgnoreCase(destName, "mgnlNew")) { destName = null; } hm.getContent(pathParent).orderBefore(srcName, destName); hm.save(); } catch (RepositoryException e) { if (log.isDebugEnabled()) log.debug("Exception caught: " + e.getMessage(), e); //$NON-NLS-1$ } } } }