Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package ru.miit.cms.view.beans;
- import java.util.ArrayList;
- import java.util.List;
- import java.util.Map;
- import javax.faces.application.FacesMessage;
- import javax.faces.component.UIComponent;
- import javax.faces.context.FacesContext;
- import javax.faces.event.ActionEvent;
- import javax.faces.event.ValueChangeEvent;
- import javax.faces.model.SelectItem;
- import oracle.adf.model.BindingContext;
- import oracle.adf.model.binding.DCBindingContainer;
- import oracle.adf.model.binding.DCIteratorBinding;
- import oracle.adf.share.ADFContext;
- import oracle.adf.share.logging.ADFLogger;
- import oracle.adf.view.rich.component.rich.RichPopup;
- import oracle.adf.view.rich.component.rich.data.RichColumn;
- import oracle.adf.view.rich.component.rich.data.RichTable;
- import oracle.adf.view.rich.component.rich.layout.RichPanelTabbed;
- import oracle.adf.view.rich.component.rich.layout.RichShowDetailItem;
- import oracle.adf.view.rich.context.AdfFacesContext;
- import oracle.adf.view.rich.event.DialogEvent;
- import oracle.adf.view.rich.event.PopupFetchEvent;
- import oracle.adf.view.rich.event.QueryEvent;
- import oracle.adf.view.rich.model.FilterableQueryDescriptor;
- import oracle.adf.view.rich.render.ClientEvent;
- import oracle.binding.BindingContainer;
- import oracle.binding.OperationBinding;
- import oracle.jbo.Key;
- import oracle.jbo.Row;
- import oracle.jbo.domain.DBSequence;
- import oracle.jbo.domain.Number;
- import org.apache.myfaces.trinidad.event.ReturnEvent;
- import org.apache.myfaces.trinidad.event.SelectionEvent;
- import ru.miit.cms.view.CmsResourceBundle;
- import ru.miit.cms.view.utils.ADFUtils;
- import ru.miit.cms.view.utils.Iterators;
- import ru.miit.cms.view.utils.JSFUtils;
- import ru.miit.cms.view.utils.TableCriteriaManager;
- import ru.miit.cms.view.utils.UIManager;
- import ru.miit.cms.view.utils.currentrow.AbstractRowSetter;
- import ru.miit.cms.view.utils.currentrow.ContentComplexRowSetter;
- import ru.miit.cms.view.utils.currentrow.InformationRowSetter;
- import ru.miit.cms.view.utils.currentrow.KindInformationRowSetter;
- public class Page1ManagedBean {
- private RichPopup contentDeletePopup;
- private RichShowDetailItem contentTab;
- public Page1ManagedBean() {
- super();
- // _logger.info("new instance");
- }
- private static ADFLogger _logger = ADFLogger.createADFLogger(Page1ManagedBean.class);
- private RichPanelTabbed infPanelTabbed;
- public void showDeleteContentPopup(ClientEvent ce) {
- contentDeletePopup.show(new RichPopup.PopupHints());
- }
- public String rollback() {
- Key kiKey = ADFUtils.findIterator("KindInformationView1Iterator").getCurrentRow().getKey();
- Key iKey = ADFUtils.findIterator("InformationView1Iterator").getCurrentRow().getKey();
- Key ccKey = ADFUtils.findIterator("ContentComplexView1Iterator").getCurrentRow().getKey();
- ADFUtils.findOperation("Rollback").execute();
- if (TableCriteriaManager.setKindInformationCurrentRow(kiKey)) {
- if (TableCriteriaManager.setInformationCurrentRow(iKey)) {
- TableCriteriaManager.setContentComplexCurrentRow(ccKey);
- }
- }
- return null;
- }
- // public void onInformationQuery_original(QueryEvent queryEvent) {
- // //default EL string created when dragging the table
- // //to the JSF page
- // //#{bindings.allEmployeesQuery.processQuery}
- //
- // FilterableQueryDescriptor fqd =
- // (FilterableQueryDescriptor)queryEvent.getDescriptor();
- // Map map = fqd.getFilterCriteria();
- //
- // BindingContext bctx = BindingContext.getCurrent();
- // DCBindingContainer bindings =
- // (DCBindingContainer)bctx.getCurrentBindingsEntry();
- //
- // //access the method bindings to set the bind variables on the ViewCriteria
- // OperationBinding rangeStartOperationBinding =
- // bindings.getOperationBinding("setActualDateRangeStart");
- // OperationBinding rangeEndOperationBinding =
- // bindings.getOperationBinding("setActualDateRangeEnd");
- //
- // //get the temporary and transient attributes from the filter map
- // //note that these attributes exist no-where in the business service
- // Object actualDateStartRange = map.get("ActualDateRangeStart");
- // Object actualDateEndRange = map.get("ActualDateRangeEnd");
- //
- // //set the start and end date of the range to search
- // rangeStartOperationBinding.getParamsMap().put("value",
- // actualDateStartRange);
- // rangeEndOperationBinding.getParamsMap().put("value",
- // actualDateEndRange);
- //
- // //remove temporary attributes as they don't exist in the
- // //business service and would cause a NPE if passed with
- // //the query
- //
- // map.remove("ActualDateRangeStart");
- // map.remove("ActualDateRangeEnd");
- //
- // // hisdate range filter
- //
- //
- // //set bind variable on the business service
- // rangeStartOperationBinding.execute();
- // rangeEndOperationBinding.execute();
- //
- // //MethodExpression processQuery = (MethodExpression)
- //
- // JSFUtils.resolveMethodExpression("#{bindings.InformationView1Query.processQuery}",
- // Object.class,
- // new Class[] { QueryEvent.class },
- // new Object[] { queryEvent });
- //
- //
- // //put values back so search filter is not empty
- // map.put("ActualDateRangeStart", actualDateStartRange);
- // map.put("ActualDateRangeEnd", actualDateEndRange);
- //
- // }
- public void deleteContentDialogListener(DialogEvent de) {
- if (de.getOutcome() == DialogEvent.Outcome.ok) {
- boolean success = false;
- Object result = null;
- try {
- OperationBinding deleteOperation = ADFUtils.findOperation("deleteContentVersion");
- result = deleteOperation.execute();
- // success = (deleteOperation.getErrors().isEmpty() && (result = deleteOperation.getResult()) == null);
- success = (deleteOperation.getErrors().isEmpty() && result == null);
- } catch (Exception ex) {
- ex.printStackTrace();
- }
- if (success) {
- // refreshContentTable();
- UIManager.refreshContentComplexPanelCollection(true, false);
- } else {
- //TODO in Russian!
- String message = "Content delete error";
- if (result != null && result instanceof Exception) {
- message += ((Exception)result).getMessage(); // toString(); ?
- }
- FacesContext.getCurrentInstance().addMessage(null, new FacesMessage(message));
- }
- }
- }
- private Object applyDateRangeFilter(Map map, String attributeName) {
- BindingContext bctx = BindingContext.getCurrent();
- DCBindingContainer bindings = (DCBindingContainer)bctx.getCurrentBindingsEntry();
- //access the method bindings to set the bind variables on the ViewCriteria
- OperationBinding rangeOperationBinding = bindings.getOperationBinding("set" + attributeName);
- //get the temporary and transient attributes from the filter map
- //note that these attributes exist no-where in the business service
- Object dateRange = map.get(attributeName);
- //set the start and end date of the range to search
- rangeOperationBinding.getParamsMap().put("value", dateRange);
- //remove temporary attributes as they don't exist in the
- //business service and would cause a NPE if passed with
- //the query
- map.remove(attributeName);
- //set bind variable on the business service
- rangeOperationBinding.execute();
- return dateRange;
- }
- public void onInformationQuery(QueryEvent queryEvent) {
- //default EL string created when dragging the table
- //to the JSF page
- //#{bindings.allEmployeesQuery.processQuery}
- FilterableQueryDescriptor fqd = (FilterableQueryDescriptor)queryEvent.getDescriptor();
- Map map = fqd.getFilterCriteria();
- String[] dateAttributeNames = { "ActualDate", "Hisdate" };
- Object[] dateStarts = new Object[dateAttributeNames.length];
- Object[] dateEnds = new Object[dateAttributeNames.length];
- for (int i = 0; i < dateAttributeNames.length; i++) {
- dateStarts[i] = applyDateRangeFilter(map, dateAttributeNames[i] + "RangeStart");
- dateEnds[i] = applyDateRangeFilter(map, dateAttributeNames[i] + "RangeEnd");
- }
- // Object actualDateStartRange = applyDateRangeFilter(map, "ActualDateRangeStart");
- // Object actualDateEndRange = applyDateRangeFilter(map, "ActualDateRangeEnd");
- //MethodExpression processQuery = (MethodExpression)
- JSFUtils.resolveMethodExpression("#{bindings.InformationView1Query.processQuery}", Object.class,
- new Class[] { QueryEvent.class }, new Object[] { queryEvent });
- //put values back so search filter is not empty
- // map.put("ActualDateRangeStart", actualDateStartRange);
- // map.put("ActualDateRangeEnd", actualDateEndRange);
- for (int i = 0; i < dateAttributeNames.length; i++) {
- map.put(dateAttributeNames[i] + "RangeStart", dateStarts[i]);
- map.put(dateAttributeNames[i] + "RangeEnd", dateEnds[i]);
- }
- }
- public void openTab(ActionEvent ae) {
- String tabNumString = (String)ae.getComponent().getAttributes().get("tabNum");
- if (tabNumString != null) {
- try {
- UIManager.openTab(Integer.parseInt(tabNumString));
- } catch (Exception e) {
- _logger.severe(e);
- }
- }
- }
- public void selectParamTab(ClientEvent clientEvent) {
- UIManager.openTab(0);
- // selectInfTab(0);
- }
- public void selectContentTab(ClientEvent clientEvent) {
- UIManager.openTab(1);
- // selectInfTab(1);
- }
- public void selectCategsTab(ClientEvent clientEvent) {
- UIManager.openTab(2);
- // selectInfTab(2);
- }
- public void selectBindsTab(ClientEvent clientEvent) {
- UIManager.openTab(3);
- // selectInfTab(3);
- }
- //
- // private void selectInfTab(int selectItemIndex) {
- // try {
- // List<UIComponent> tabs = infPanelTabbed.getChildren();
- // if (tabs.get(selectItemIndex) instanceof RichShowDetailItem &&
- // !((RichShowDetailItem)tabs.get(selectItemIndex)).isDisclosed()) {
- // for (int currentIndex = 0; currentIndex < tabs.size();
- // currentIndex++) {
- // UIComponent child = tabs.get(currentIndex);
- // if (child instanceof RichShowDetailItem) {
- // ((RichShowDetailItem)child).setDisclosed(currentIndex ==
- // selectItemIndex);
- // }
- // }
- // AdfFacesContext.getCurrentInstance().addPartialTarget(infPanelTabbed);
- // }
- // } catch (Exception e) {
- // e.printStackTrace();
- // }
- // }
- public boolean isCategorySelected() {
- // System.out.println(getClass() + ".isCategorySelected(): line 223");
- List<Number> selectedCategoriesList = // does not match any LVT entry
- // List selectedCategoriesList =
- ADFUtils.attributeListForIterator("BindingInfCategoriesView1Iterator", "IdInformationCategory");
- if (selectedCategoriesList.isEmpty()) {
- return false;
- }
- Number idInformationCategory = (Number)JSFUtils.resolveExpression("#{row.IdInformationCategory}");
- return selectedCategoriesList.contains(idInformationCategory);
- }
- // public boolean isCategorySelected() {
- // // System.out.println(getClass() + ".isCategorySelected(): line 223");
- //
- // List<Number> selectedCategoriesList =
- // ADFUtils.attributeListForIterator("BindingInfCategoriesView1Iterator", "IdInformationCategory");
- // if (selectedCategoriesList.isEmpty()) {
- // return false;
- // }
- // Number idInformationCategory = (Number)JSFUtils.resolveExpression("#{row.IdInformationCategory}");
- // return selectedCategoriesList.contains(idInformationCategory);
- // }
- public String addCategory() {
- OperationBinding createOper = ADFUtils.findOperation("CreateInfCategory");
- if (ADFUtils.findOperation("DeleteInfCategoryForDisable").isOperationEnabled()) {
- createOper.execute();
- if (!createOper.getErrors().isEmpty()) {
- System.err.println("addCategory() errors");
- return null;
- }
- ADFUtils.findOperation("Commit").execute();
- }
- try {
- ADFUtils.findIterator("AvailInformationCategoriesView1Iterator").executeQuery();
- AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc6:t9"));
- AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc5:t10"));
- //ADFUtils.findIterator("InformationCategoryView1Iterator").getViewObject().next();
- } catch (Exception e) {
- System.err.println("addCategory() deselect row error");
- }
- return null;
- }
- public void addCategory(ClientEvent clientEvent) {
- addCategory();
- }
- public String deleteCategory() {
- OperationBinding deleteOper = ADFUtils.findOperation("DeleteCurrentBindingInfCategories");
- if (deleteOper.isOperationEnabled()) {
- deleteOper.execute();
- if (!deleteOper.getErrors().isEmpty()) {
- System.err.println("deleteCategory() errors");
- return null;
- }
- }
- ADFUtils.findOperation("Commit").execute();
- ADFUtils.findIterator("AvailInformationCategoriesView1Iterator").executeQuery();
- AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc6:t9"));
- AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc5:t10"));
- // try {
- // ((RichTable)FacesContext.getCurrentInstance().getViewRoot().findComponent(
- // "pc6:t9"
- // )).setSelectedRowKeys(null);
- // } catch (Exception e) {
- // System.err.println("deleteCategory() deselect row error");
- // }
- return null;
- }
- public void deleteCategory(ClientEvent clientEvent) {
- deleteCategory();
- }
- // public void linkMetatermReturnListener(ReturnEvent e) {
- // ADFUtils.findIterator(Iterators.INFORMATION_METATERMS_KIS).executeQuery();
- // AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc7:t5"));
- // AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc7:cb18"));
- //
- // }
- //
- // public void deleteMetatermDialogListener(DialogEvent de) {
- // if (de.getOutcome().equals(DialogEvent.Outcome.yes)) {
- // ADFUtils.findIterator(Iterators.INFORMATION_METATERMS_KIS).removeCurrentRow();
- // ADFUtils.findOperation("Commit").execute();
- // AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc7:t5"));
- // AdfFacesContext.getCurrentInstance().addPartialTarget(FacesContext.getCurrentInstance().getViewRoot().findComponent("pc7:cb18"));
- // }
- // }
- /**
- * method for getting bookmarkable link, works but unused
- * @return
- */
- public String getBookmarkableLink() {
- String link = null;
- String kiRowKey = ADFUtils.findIterator("KindInformationView1Iterator").getCurrentRowWithKeyValue();
- String iRowKey = ADFUtils.findIterator("InformationView1Iterator").getCurrentRowWithKeyValue();
- String ccRowKey = ADFUtils.findIterator("ContentComplexView1Iterator").getCurrentRowWithKeyValue();
- List<UIComponent> tabs = infPanelTabbed.getChildren();
- int tabNum = -1;
- for (UIComponent tab : tabs) {
- if (tab instanceof RichShowDetailItem) {
- tabNum++;
- if (((RichShowDetailItem)tab).isDisclosed()) {
- break;
- }
- }
- }
- link = kiRowKey + ":" + iRowKey + ":" + ccRowKey + ":" + tabNum;
- return link;
- }
- public void addMetatermLink(ActionEvent e) {
- ADFUtils.findOperation("CreateInformationMetaterm").execute();
- ADFUtils.findIterator("InformationMetatermsKisView1Iterator").executeQuery();
- ADFUtils.findOperation("Commit").execute();
- }
- public void delMetatermLink(ActionEvent e) {
- ADFUtils.findOperation("DeleteInformationMetaterm").execute();
- ADFUtils.findOperation("Commit").execute();
- }
- public boolean isAddMetatermLinkAllowed() {
- return !ADFUtils.attributeListForIterator("InformationMetatermsKisView1Iterator",
- "IdMetatermKis").contains(ADFUtils.getBoundAttributeValue("IdMetaterm"));
- }
- public void toActualInformation(ActionEvent ae) {
- toInformationId((Number)ADFUtils.getBoundAttributeValue("ActualIdInf"));
- }
- public void toBaseInformation(ActionEvent ae) {
- toInformationId((Number)ADFUtils.getBoundAttributeValue("IdIVersion"));
- }
- public void toInformationId(Number idInformation) {
- if (TableCriteriaManager.setInformationCurrentRow(new DBSequence(idInformation))) {
- UIManager.refreshComponent("d1");
- } else {
- RichColumn idColumn = (RichColumn)UIManager.getComponent("pc1:t2:c_i_id");
- if (idColumn != null) {
- idColumn.setVisible(true);
- UIManager.refreshInformationTable();
- }
- }
- }
- // public void toActualContentVersion(ActionEvent ae) {
- // System.out.println(getClass() + ".toActualContentVersion");
- // Number actialIdContentVersion = (Number)ADFUtils.getBoundAttributeValue("ActualIdContentVer");
- // RichTable table =
- // (RichTable)FacesContext.getCurrentInstance().getViewRoot().findComponent("pc2:t3");
- // TableCriteriaManager.clearTableFilter(table,
- // "ContentComplexView1Query");
- // // ADFUtils.findOperation("setActualCVRow").execute();
- // ADFUtils.findIterator(Iterators.CONTENT_COMPLEX).setCurrentRowWithKeyValue(actialIdContentVersion.toString());
- //
- // // AdfFacesContext.getCurrentInstance().addPartialTarget(table);
- // // redrawContentTable();
- // // return null;
- // }
- public void toContentSearchResult(DialogEvent de) {
- if (de.getOutcome() == DialogEvent.Outcome.ok) {
- // DCIteratorBinding iter = Iterators.getIterator("GeneralSearch1Iterator");
- Row row = Iterators.getIterator("GeneralSearch1Iterator").getCurrentRow();
- if (row != null) {
- // **********************8
- // boolean found = false;
- if (TableCriteriaManager.setKindInformationCurrentRow((Number)row.getAttribute("IdkInformation"))) {
- if (TableCriteriaManager.setInformationCurrentRow((DBSequence)row.getAttribute("IdInformation"))) {
- TableCriteriaManager.setContentComplexCurrentRow((DBSequence)row.getAttribute("IdContentVersion"));
- }
- }
- //
- // if(!found) {
- // // Ne udalos' vypolnit' perehod
- // UIManager.showPopup("Не удалось выполнить переход");
- // }
- // **************************
- // if(new KindInformationRowSetter().setCurrentRow(row.getAttribute("IdkInformation"))) {
- // if(new InformationRowSetter().setCurrentRow(row.getAttribute("IdInformation"))) {
- // new ContentComplexRowSetter().setCurrentRow(row.getAttribute("IdContentVersion"));
- // }
- // }
- //
- // if(!found) {
- // // Ne udalos' vypolnit' perehod
- // UIManager.showPopup("Не удалось выполнить переход");
- // }
- // *****************************************************
- //
- // try {
- // Iterators.getKindInformationIterator().setCurrentRowWithKeyValue(row.getAttribute("IdkInformation").toString());
- //
- // TableCriteriaManager.clearInformationTableFilter();
- // int rangeSize = Iterators.getInformationIterator().getRangeSize();
- // Iterators.getInformationIterator().setRangeSize(-1);
- // Iterators.getInformationIterator().setCurrentRowWithKeyValue(row.getAttribute("IdInformation").toString());
- // Iterators.getInformationIterator().setRangeSize(rangeSize);
- //
- // TableCriteriaManager.clearContentComplexTableFilter();
- // Iterators.getContentComplexIterator().setCurrentRowWithKeyValue(row.getAttribute("IdContentVersion").toString());
- // } catch (Exception e) {
- // System.err.println("toContentSearchResult failed to IDK_INFORMATION " +
- // row.getAttribute("IdkInformation") + ", ID_INFORMATION " +
- // row.getAttribute("IdInformation") + ", ID_CONTENT)VERSION " +
- // row.getAttribute("IdContentVersion"));
- // // Ne udalos' vypolnit' perehod
- // UIManager.showPopup("Не удалось выполнить переход");
- // }
- UIManager.refreshKindInformationTable();
- UIManager.refreshInformationTable();
- UIManager.refreshContentComplexPanelCollection();
- selectContentTab(null);
- }
- }
- }
- public void switchInfStatus(ActionEvent actionEvent) {
- ADFUtils.setBoundAttributeValue("UseSignInf1",
- ADFUtils.getBoundAttributeValue("UseSignInf1").equals(new Number(1)) ?
- new Number(0) : new Number(1));
- ValueChangeEvent vae = new ValueChangeEvent(actionEvent.getComponent(), null, null);
- JSFUtils.resolveMethodExpression("#{Page1UIBean.commitValueChangeListener}", Class.class,
- new Class[] { ValueChangeEvent.class }, new Object[] { vae });
- UIManager.refreshInformationTable();
- //Number
- }
- // public boolean isAllKindsContentCreated() {
- // Row[] rows = ADFUtils.findIterator("KindsContentTypesInfView1Iterator").getAllRowsInRange();
- // Set obligatoryRowSet = new HashSet();
- //
- // for(Row row : rows) {
- // if(row.getAttribute("Obligatory") != null && ((Number)row.getAttribute("Obligatory")).intValue() == 1) {
- // obligatoryRowSet.add(row.getAttribute("IdkContent"));
- // }
- // }
- //
- // Row[] contentRows = Iterators.getContentComplexIterator().getAllRowsInRange();
- // for(Row row : contentRows) {
- // if(obligatoryRowSet.contains(row.getAttribute("IdkContent"))) {
- // obligatoryRowSet.remove(row.getAttribute("IdkContent"));
- // }
- // }
- //
- // return obligatoryRowSet.size() == 0;
- // }
- public void setKindContentBeforeCreate(ActionEvent actionEvent) {
- Iterators.getIterator("KindsContentTypesInfView1Iterator").setCurrentRowWithKey((String)JSFUtils.resolveExpression("#{row.rowKeyStr}"));
- }
- public void setContentDeletePopup(RichPopup contentDeletePopup) {
- this.contentDeletePopup = contentDeletePopup;
- }
- public RichPopup getContentDeletePopup() {
- return contentDeletePopup;
- }
- public void rtePreviewPopupFetchListener(PopupFetchEvent popupFetchEvent) {
- // ADFUtils.findIterator("LargeTextDataRestoredView1Iterator").executeQuery();
- ADFUtils.findOperation("getRestoredText").execute();
- }
- public void informationTableSelectionListener(SelectionEvent se) {
- DCIteratorBinding ccIter = null;
- Number idkContent = null;
- boolean doPreserve = contentTab.isDisclosed();
- if (doPreserve) {
- Long preserveKindContent = (Long)ADFContext.getCurrent().getSessionScope().get("preserveKindContent");
- doPreserve = preserveKindContent == null || preserveKindContent.equals(1L);
- if (doPreserve) {
- try {
- ccIter = Iterators.getContentComplexIterator();
- Row ccRow = ccIter.getCurrentRow();
- if (ccRow != null) {
- idkContent = (Number)ccRow.getAttribute("IdkContent");
- }
- } catch (Exception e) {
- e.printStackTrace();
- _logger.severe("Failed receiving ContentComplex kind content", e);
- }
- }
- }
- JSFUtils.resolveMethodExpression("#{bindings.InformationView1.collectionModel.makeCurrent}", null,
- new Class[] { SelectionEvent.class }, new Object[] { se });
- if (doPreserve) {
- try {
- if (ccIter != null && idkContent != null) {
- Row[] rows = ccIter.getAllRowsInRange();
- if (rows.length > 1) {
- for (Row row : rows) {
- if (row.getAttribute("IdkContent").equals(idkContent)) {
- TableCriteriaManager.setContentComplexCurrentRow(row.getKey());
- break;
- }
- }
- }
- }
- } catch (Exception e) {
- e.printStackTrace();
- _logger.severe("Failed restoring ContentComplex kind content", e);
- }
- }
- }
- public void setContentTab(RichShowDetailItem contentTab) {
- this.contentTab = contentTab;
- }
- public RichShowDetailItem getContentTab() {
- return contentTab;
- }
- public String searchAction() {
- System.out.print("searchAction");
- String action = null;
- if (JSFUtils.resolveExpression("#{viewScope.searchQuery}") != null) {
- action =
- (String)JSFUtils.resolveExpression("#{viewScope.searchSource == 1 ? 'search-inf' : 'search-content'}");
- }
- System.out.println(" = "+action);
- return action;
- }
- public String advancedSearchAction() {
- return (String)JSFUtils.resolveExpression("#{viewScope.searchSource == 1 ? 'search-inf' : 'search-content'}");
- }
- public void searchReturnListener(ReturnEvent returnEvent) {
- String searchSourceString = (String)JSFUtils.resolveExpression("#{viewScope.searchSource}");
- if (searchSourceString != null) {
- Integer searchSource = Integer.parseInt(searchSourceString);
- switch (searchSource) {
- case 1:
- {
- // information
- if (TableCriteriaManager.setKindInformationCurrentRow((Number)returnEvent.getReturnParameters().get("IdkInformationToGo"))) {
- if (TableCriteriaManager.setInformationCurrentRow((DBSequence)returnEvent.getReturnParameters().get("IdInformationToGo"))) {
- UIManager.refreshComponent("d1");
- } else {
- UIManager.refreshKindInformationTable();
- }
- }
- break;
- }
- case 2:
- {
- // content
- if (TableCriteriaManager.setKindInformationCurrentRow((Number)returnEvent.getReturnParameters().get("IdkInformationToGo"))) {
- if (TableCriteriaManager.setInformationCurrentRow((Number)returnEvent.getReturnParameters().get("IdInformationToGo"))) {
- if (TableCriteriaManager.setContentComplexCurrentRow((DBSequence)returnEvent.getReturnParameters().get("IdContentVersionToGo"))) {
- selectContentTab(null);
- UIManager.refreshComponent("d1");
- } else {
- UIManager.refreshKindInformationTable();
- UIManager.refreshInformationTable();
- }
- } else {
- UIManager.refreshKindInformationTable();
- }
- }
- break;
- }
- }
- }
- }
- public void createInformation(ActionEvent ae) {
- createInformation((Number)null);
- }
- public void createInformationVersion(ActionEvent ae) {
- createInformation((Number)ADFUtils.getBoundAttributeValue("IdIVersion"));
- }
- private void createInformation(Number IdIVersion) {
- OperationBinding createInf = ADFUtils.findOperation("CreateInformation");
- createInf.getParamsMap().put("IdIVersion", IdIVersion);
- createInf.execute();
- ADFUtils.findOperation("Commit").execute();
- Key k = Iterators.getInformationIterator().getCurrentRow().getKey();
- ADFUtils.findOperation("ExecuteInformation").execute();
- TableCriteriaManager.setInformationCurrentRow(k);
- UIManager.notifyByKey("INFORMATION_CREATED");
- }
- public void copyInformation(ActionEvent actionEvent) {
- BindingContainer binding = BindingContext.getCurrent().getCurrentBindingsEntry();
- OperationBinding copyInf = binding.getOperationBinding("copyInformation");
- copyInf.execute();
- if (copyInf.getErrors().isEmpty()) {
- Integer newIdInformation = (Integer)copyInf.getResult();
- DBSequence dbNewId = new DBSequence(newIdInformation);
- //Create a Key object
- Key key = new Key(new Object[] { dbNewId });
- new InformationRowSetter().setCurrentRow(key);
- //refresh components on JSF Page
- UIManager.refreshInformationTable(true, true);
- UIManager.notifyByKey("INFORMATION_COPIED");
- } else {
- UIManager.showErrorPopupMessageKey("INFORMATION_COPY_ERROR");
- }
- }
- public void setInfPanelTabbed(RichPanelTabbed infPanelTabbed) {
- this.infPanelTabbed = infPanelTabbed;
- }
- public RichPanelTabbed getInfPanelTabbed() {
- return infPanelTabbed;
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement