bugged
stringlengths 6
599k
| fixed
stringlengths 10
599k
| __index_level_0__
int64 0
1.13M
|
|---|---|---|
public VCard getVCard(String jid) { if (!vcardMap.containsKey(jid)) { VCard vcard = new VCard(); try { vcard.load(SparkManager.getConnection(), jid); vcardMap.put(jid, vcard); } catch (XMPPException e) { Log.warning("Unable to load vcard for " + jid, e); vcard.setError(new XMPPError(409)); } } return (VCard)vcardMap.get(jid); }
|
public VCard getVCard(String jid) { if (!vcardMap.containsKey(jid)) { VCard vcard = new VCard(); try { vcard.load(SparkManager.getConnection(), jid); vcardMap.put(jid, vcard); } catch (XMPPException e) { Log.warning("Unable to load vcard for " + jid, e); vcard.setError(new XMPPError(409)); } } return (VCard)vcardMap.get(jid); }
| 1,122,160
|
public VCard getVCard(String jid) { if (!vcardMap.containsKey(jid)) { VCard vcard = new VCard(); try { vcard.load(SparkManager.getConnection(), jid); vcardMap.put(jid, vcard); } catch (XMPPException e) { Log.warning("Unable to load vcard for " + jid, e); vcard.setError(new XMPPError(409)); } } return (VCard)vcardMap.get(jid); }
|
public VCard getVCard(String jid) { if (!vcardMap.containsKey(jid)) { VCard vcard = new VCard(); try { vcard.load(SparkManager.getConnection(), jid); vcardMap.put(jid, vcard); } catch (XMPPException e) { Log.warning("Unable to load vcard for " + jid, e); vcard.setError(new XMPPError(409)); } } return vcard; }
| 1,122,161
|
List getAnnotations(long ownerID) { return (List) annotations.get(new Long(ownerID)); }
|
List getAnnotations(long ownerID) { return (List) annotations.get(new Long(ownerID)); }
| 1,122,164
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ getArticleItemBean().setResourcePath(resourcePath); } if(baseFolderPath!=null){ getArticleItemBean().setBaseFolderLocation(baseFolderPath); } if(isInCreateMode()){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,166
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); categoriesUI.reset(); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,167
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(); WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); if(categoriesUI!=null){ categoriesUI.setResourcePath(resourcePath); } } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,168
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,169
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); // if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange","");
| 1,122,170
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange = getArticleItemBean().getLanguageChange(); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,171
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { /*String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,172
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
|
public void encodeBegin(FacesContext context) throws IOException { if(clearOnInit) { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "clear"); ArticleItemBean bean = getArticleItemBean(); if(bean!=null){ bean.clear(); } } // WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "updateLocale");// updateEditButtons(); super.encodeBegin(context); IWContext iwc = IWContext.getIWContext(context); String resourcePath = iwc.getParameter(ContentViewer.PARAMETER_CONTENT_RESOURCE); if(resourcePath!=null){ if("create".equals(iwc.getParameter(ContentViewer.PARAMETER_ACTION))){ //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"setFolderLocation",resourcePath,String.class); getArticleItemBean().setFolderLocation(resourcePath); } else { //WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"load",resourcePath,String.class); try { getArticleItemBean().load(resourcePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } WebDAVCategories categoriesUI = (WebDAVCategories)getCategoryEditor(); //Update the categoriesUI with the resourcePath given: if(!isInCreateMode()&& categoriesUI!=null){ //there is no resourcepath set for the article if it's about to be created categoriesUI.setResourcePath(resourcePath); } }// if(((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange")).booleanValue()) { String languageChange=(String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID,"getLanguageChange"); if(languageChange!=null) { String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); if(null!=articlePath && articlePath.length()>0) { boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+languageChange+ArticleItemBean.ARTICLE_FILE_SUFFIX)).booleanValue(); if(!result) { System.out.println("Warning loading new language did not work!"); } } WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",""); } }
| 1,122,173
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); // String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
| 1,122,175
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
| 1,122,177
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
|
public UIComponent getEditContainer() { IWContext iwc = IWContext.getInstance(); WFResourceUtil localizer = WFResourceUtil.getResourceUtilArticle(); String ref = ARTICLE_ITEM_BEAN_ID + ".";// String bref = WFPage.CONTENT_BUNDLE + "."; WFContainer mainContainer = new WFContainer(); mainContainer.setId(ARTICLE_EDITOR_ID); WFErrorMessages em = new WFErrorMessages(); em.addErrorMessage(HEADLINE_ID); em.addErrorMessage(TEASER_ID);// em.addErrorMessage(PUBLISHED_FROM_DATE_ID);// em.addErrorMessage(PUBLISHED_TO_DATE_ID); em.addErrorMessage(SAVE_ID); mainContainer.add(em); HtmlPanelGrid p = WFPanelUtil.getPlainFormPanel(2); //Language dropdown p.getChildren().add(WFUtil.group(localizer.getTextVB("language"), WFUtil.getText(":"))); Iterator iter = ICLocaleBusiness.getListOfLocalesJAVA().iterator(); HtmlSelectOneMenu langDropdown = new HtmlSelectOneMenu(); List arrayList = new ArrayList(); while(iter.hasNext()) { Locale locale = (Locale)iter.next(); String keyStr = locale.getLanguage(); String langStr = locale.getDisplayLanguage(); SelectItem itemTemp = new SelectItem(keyStr, langStr, keyStr, false); arrayList.add(itemTemp); } UISelectItems items = new UISelectItems(); items.setId(LOCALE_ID); items.setValue(arrayList); langDropdown.getChildren().add(items); ValueBinding vb = WFUtil.createValueBinding("#{" + ref +"contentLanguage" + "}"); langDropdown.setValueBinding("value", vb); langDropdown.getValue(); langDropdown.addValueChangeListener(this); langDropdown.setImmediate(true); langDropdown.setOnchange("submit();"); p.getChildren().add(langDropdown); p.getChildren().add(WFUtil.group(localizer.getTextVB("headline"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "language"), WFUtil.getText(":"))); HtmlInputText headlineInput = WFUtil.getInputText(HEADLINE_ID, ref + "headline"); headlineInput.setSize(70); p.getChildren().add(headlineInput); //HtmlSelectOneMenu localeMenu = WFUtil.getSelectOneMenu(LOCALE_ID, ref + "allLocales", ref + "pendingLocaleId"); //localeMenu.setOnchange("document.forms[0].submit();"); //p.getChildren().add(localeMenu); p.getChildren().add(WFUtil.group(localizer.getTextVB("author"), WFUtil.getText(":"))); HtmlInputText authorInput = WFUtil.getInputText(AUTHOR_ID, ref + "author"); authorInput.setSize(70); User user = iwc.getCurrentUser(); if(user!=null){ String userName = user.getName(); getArticleItemBean().setAuthor(userName); } p.getChildren().add(authorInput); //Article body p.getChildren().add(WFUtil.group(localizer.getTextVB("body"), WFUtil.getText(":"))); HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body", "500px", "400px"); //HTMLArea bodyArea = WFUtil.getHtmlAreaTextArea(BODY_ID, ref + "body"); /*bodyArea.addPlugin(HTMLArea.PLUGIN_TABLE_OPERATIONS); bodyArea.addPlugin(HTMLArea.PLUGIN_DYNAMIC_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CSS, "3"); bodyArea.addPlugin(HTMLArea.PLUGIN_CONTEXT_MENU); bodyArea.addPlugin(HTMLArea.PLUGIN_LIST_TYPE); bodyArea.addPlugin(HTMLArea.PLUGIN_CHARACTER_MAP); */ bodyArea.setAllowFontSelection(false); //bodyArea.addPlugin("TableOperations"); //bodyArea.addPlugin("Template"); //bodyArea.addPlugin("Forms"); //bodyArea.addPlugin("FormOperations"); //bodyArea.addPlugin("EditTag"); //bodyArea.addPlugin("Stylist"); //bodyArea.addPlugin("CSS"); //bodyArea.addPlugin("DynamicCSS"); //bodyArea.addPlugin("FullPage"); //bodyArea.addPlugin("NoteServer"); //bodyArea.addPlugin("QuickTag"); //bodyArea.addPlugin("InsertSmiley"); //bodyArea.addPlugin("InsertWords"); //bodyArea.addPlugin("ContextMenu"); //bodyArea.addPlugin("LangMarks"); //bodyArea.addPlugin("DoubleClick"); //bodyArea.addPlugin("ListType"); //bodyArea.addPlugin("ImageManager"); p.getChildren().add(WFUtil.group(bodyArea, WFUtil.getBreak())); p.getChildren().add(WFUtil.group(localizer.getTextVB("teaser"), WFUtil.getText(":"))); HtmlInputTextarea teaserArea = WFUtil.getTextArea(TEASER_ID, ref + "teaser", "500px", "60px"); p.getChildren().add(teaserArea); p.getChildren().add(WFUtil.group(localizer.getTextVB("source"), WFUtil.getText(":"))); HtmlInputText sourceArea = WFUtil.getInputText(SOURCE_ID, ref + "source"); sourceArea.setSize(70); p.getChildren().add(sourceArea); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getPlainFormPanel(1);/* p.getChildren().add(WFUtil.group(WFUtil.getHeaderTextVB(bref + "created"), WFUtil.getTextVB(ref + "creationDate") ));*/// p.getChildren().add(WFUtil.getText(" "));// UIComponent t = WFUtil.group(localizer.getHeaderTextVB("status"), WFUtil.getText(": "));// t.getChildren().add(WFUtil.getTextVB(ref + "status"));// p.getChildren().add(t); p.getChildren().add(WFUtil.group(localizer.getTextVB("status"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "status")); p.getChildren().add(WFUtil.group(localizer.getTextVB("current_version"), WFUtil.getText(":"))); p.getChildren().add(WFUtil.getTextVB(ref + "versionName")); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); // p = WFPanelUtil.getFormPanel(2); p.getChildren().add(WFUtil.group(localizer.getTextVB("comment"), WFUtil.getText(":")));// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "attachments"), WFUtil.getText(":"))); HtmlInputTextarea commentArea = WFUtil.getTextArea(COMMENT_ID, ref + "comment", "500px", "60px"); p.getChildren().add(commentArea);// WFContainer attachmentContainer = new WFContainer();// attachmentContainer.add(WFUtil.getButtonVB(ADD_ATTACHMENT_ID, bref + "add_attachment", this));// attachmentContainer.add(WFUtil.getBreak());// attachmentContainer.add(getAttachmentList());// p.getChildren().add(attachmentContainer); // mainContainer.add(p); // p = WFPanelUtil.getFormPanel(1);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "related_content_items"), WFUtil.getText(":"))); // WFContainer contentItemContainer = new WFContainer(); // contentItemContainer.add(WFUtil.getButtonVB(ADD_RELATED_CONTENT_ITEM_ID, bref + "add_content_item", this));// contentItemContainer.add(WFUtil.getBreak());// contentItemContainer.add(getRelatedContentItemsList());// p.getChildren().add(contentItemContainer);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "publishing_date"), WFUtil.getText(":"))); // WFDateInput publishedFromInput = WFUtil.getDateInput(PUBLISHED_FROM_DATE_ID, ref + "case.publishedFromDate");// publishedFromInput.setShowTime(true);// p.getChildren().add(publishedFromInput);// p.getChildren().add(WFUtil.group(WFUtil.getTextVB(bref + "expiration_date"), WFUtil.getText(":"))); // WFDateInput publishedToInput = WFUtil.getDateInput(PUBLISHED_TO_DATE_ID, ref + "case.publishedToDate");// publishedToInput.setShowTime(true);// p.getChildren().add(publishedToInput); // mainContainer.add(p); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// mainContainer.add(WFUtil.getBreak());// p = WFPanelUtil.getPlainFormPanel(1);// HtmlCommandButton editCategoriesButton = WFUtil.getButtonVB(EDIT_CATEGORIES_ID, bref + "edit_categories", this);// p.getChildren().add(editCategoriesButton); //Temporary taking away folderr location/* p.getChildren().add(WFUtil.group(localizer.getTextVB("folder"), WFUtil.getText(":"))); HtmlInputText folderInput = WFUtil.getInputText(FOLDER_ID, ref + "folderLocation"); if(null==folderInput.getValue() || "".equals(folderInput.getValue())) { String FolderString = ArticleUtil.getArticleYearMonthPath();// System.out.println("Folder "+FolderString); folderInput.setValue(FolderString); } else { File file = new File(folderInput.getValue().toString()); folderInput.setValue(file.getParentFile().getParent()); } folderInput.setSize(70); p.getChildren().add(folderInput); */ p.getChildren().add(WFUtil.getBreak()); //Categories// WebDAVCategories categoriesUI = new WebDAVCategories(); //ArticleItemBean articleItemBean = (ArticleItemBean) getArticleItemBean(); //String resourcePath = articleItemBean.getArticleResourcePath(); WebDAVCategories categoriesUI = (WebDAVCategories) getCategoryEditor(); if(categoriesUI==null){ //id on the component is set implicitly categoriesUI=new WebDAVCategories(); //we want to set the categories also on the parent ".article" folder: categoriesUI.setCategoriesOnParent(true); categoriesUI.setDisplaySaveButton(false); //categoriesUI.setId(CATEGORY_EDITOR_ID); //Categories are set in encodeBegin: //if(!isInCreateMode()){ //there is no resourcepath set for the article if it's about to be created // categoriesUI.setResourcePath(resourcePath); //} p.getChildren().add(categoriesUI); } p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak()); p.getChildren().add(WFUtil.getBreak());// WFComponentSelector cs = new WFComponentSelector();// cs.setId(BUTTON_SELECTOR_ID);// cs.setDividerText(" "); HtmlCommandButton saveButton = localizer.getButtonVB(SAVE_ID, "save", this);// HtmlCommandButton saveButton = WFUtil.getButtonVB(SAVE_ID, WFPage.CONTENT_BUNDLE + "save", this);// cs.add(saveButton);// cs.add(WFUtil.getButtonVB(FOR_REVIEW_ID, bref + "for_review", this));// cs.add(WFUtil.getButtonVB(PUBLISH_ID, bref + "publish", this));// cs.add(WFUtil.getButtonVB(REWRITE_ID, bref + "rewrite", this));// cs.add(WFUtil.getButtonVB(REJECT_ID, bref + "reject", this));// cs.add(WFUtil.getButtonVB(DELETE_ID, bref + "delete", this));// cs.add(WFUtil.getButtonVB(CANCEL_ID, bref + "cancel", this));// cs.setSelectedId(CANCEL_ID, true);// p.getChildren().add(cs); p.getChildren().add(saveButton); mainContainer.add(p); //WFComponentSelector editorSelector = new WFComponentSelector(); //editorSelector.setId(EDITOR_SELECTOR_ID); //editorSelector.add(mainContainer); //editorSelector.add(getCategoryEditContainer());// FileUploadForm f = new FileUploadForm(this, FILE_UPLOAD_ID, FILE_UPLOAD_CANCEL_ID); //editorSelector.add(getRelatedContentItemsContainer()); //editorSelector.setSelectedId(ARTICLE_EDITOR_ID, true); //return editorSelector; return mainContainer; }
| 1,122,178
|
public void processAction(ActionEvent event) { String id = event.getComponent().getId(); UIComponent rootParent = rootParent = event.getComponent().getParent().getParent().getParent(); EditArticleView ab = (EditArticleView) rootParent.findComponent(EDIT_ARTICLE_BLOCK_ID); if (id.equals(SAVE_ID)) { ab.storeArticle();// String resourcePath = (String) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticleResourcePath"); ArticleItemBean articleItemBean = getArticleItemBean(); String resourcePath = articleItemBean.getArticleResourcePath(); //UIComponent comp = ab.findComponent(WebDAVCategories.CATEGORIES_BLOCK_ID); WebDAVCategories categoriesUI = (WebDAVCategories) ab.getCategoryEditor(); if(categoriesUI!=null){ categoriesUI.setResourcePath(resourcePath); categoriesUI.saveCategoriesSettings(resourcePath, categoriesUI); } clearOnInit=false; } /* else if (id.equals(FOR_REVIEW_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_READY_FOR_REVIEW); ab.storeArticle(); } else if (id.equals(PUBLISH_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_PUBLISHED); ab.storeArticle(); } else if (id.equals(REWRITE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_REWRITE); ab.storeArticle(); } else if (id.equals(REJECT_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(DELETE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(ADD_IMAGE_ID)) { ab.setEditView(FILE_UPLOAD_FORM_ID); } else if (id.equals(FILE_UPLOAD_CANCEL_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(FILE_UPLOAD_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(CaseListBean.CASE_ID)){ String itemId = WFUtil.getParameter(event.getComponent(), "id"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "addRelatedContentItem", new Integer(itemId)); ab.setEditView(ARTICLE_EDITOR_ID); }*/ }
|
public void processAction(ActionEvent event) { String id = event.getComponent().getId(); UIComponent rootParent = rootParent = event.getComponent().getParent().getParent().getParent(); EditArticleView ab = (EditArticleView) rootParent.findComponent(EDIT_ARTICLE_BLOCK_ID); if (id.equals(SAVE_ID)) { ab.storeArticle();// String resourcePath = (String) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticleResourcePath"); ArticleItemBean articleItemBean = getArticleItemBean(); String resourcePath = articleItemBean.getArticleResourcePath(); //UIComponent comp = ab.findComponent(WebDAVCategories.CATEGORIES_BLOCK_ID); WebDAVCategories categoriesUI = (WebDAVCategories) ab.getCategoryEditor(); if(categoriesUI!=null){ categoriesUI.setResourcePath(resourcePath); categoriesUI.saveCategoriesSettings(resourcePath, categoriesUI); } clearOnInit=false; } /* else if (id.equals(FOR_REVIEW_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_READY_FOR_REVIEW); ab.storeArticle(); } else if (id.equals(PUBLISH_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_PUBLISHED); ab.storeArticle(); } else if (id.equals(REWRITE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_REWRITE); ab.storeArticle(); } else if (id.equals(REJECT_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(DELETE_ID)) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setRequestedStatus", ContentItemCase.STATUS_DELETED); ab.storeArticle(); } else if (id.equals(ADD_IMAGE_ID)) { ab.setEditView(FILE_UPLOAD_FORM_ID); } else if (id.equals(FILE_UPLOAD_CANCEL_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(FILE_UPLOAD_ID)) { ab.setEditView(ARTICLE_EDITOR_ID); } else if (id.equals(CaseListBean.CASE_ID)){ String itemId = WFUtil.getParameter(event.getComponent(), "id"); WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "addRelatedContentItem", new Integer(itemId)); ab.setEditView(ARTICLE_EDITOR_ID); }*/ }
| 1,122,179
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); if(null==articlePath) { //Article has not been stored previousley, so nothing have to be done return; } System.out.println("Article path"+articlePath); boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); if(result) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); }else { if(null!=language) { result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); } } }
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); if(null==articlePath) { //Article has not been stored previousley, so nothing have to be done return; } System.out.println("Article path"+articlePath); boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); if(result) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); }else { if(null!=language) { result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); } } }
| 1,122,180
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); if(null==articlePath) { //Article has not been stored previousley, so nothing have to be done return; } System.out.println("Article path"+articlePath); boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); if(result) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); }else { if(null!=language) { result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); } } }
|
public void processValueChange(ValueChangeEvent arg0) throws AbortProcessingException { if(arg0.getOldValue()==null) { return; } System.out.println("Language value has changed from "+arg0.getOldValue()+" to "+arg0.getNewValue()); String articlePath = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getArticlePath"); String language = (String)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "getContentLanguage"); if(null==articlePath) { //Article has not been stored previousley, so nothing have to be done return; } System.out.println("Article path"+articlePath); boolean result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+arg0.getNewValue()+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); if(result) { WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "setLanguageChange",arg0.getNewValue().toString()); }else { if(null!=language) { result = ((Boolean)WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "load",articlePath+"/"+language+ArticleItemBean.ARTICLE_SUFFIX)).booleanValue(); System.out.println("loading other language "+result); } } }
| 1,122,181
|
public void storeArticle() { String bref = WFPage.CONTENT_BUNDLE + "."; //boolean storeOk = ((Boolean) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "storeArticle")).booleanValue(); boolean storeOk = getArticleItemBean().storeArticle().booleanValue(); if (!storeOk) { //List errorKeys = (List) WFUtil.getValue(ARTICLE_ITEM_BEAN_ID, "errorKeys"); List errorKeys = getArticleItemBean().getErrorKeys(); if (errorKeys != null) { for (Iterator iter = errorKeys.iterator(); iter.hasNext();) { String errorKey = (String) iter.next(); WFUtil.addMessageVB(findComponent(SAVE_ID), bref + errorKey); } } return; } setEditMode(EDIT_MODE_EDIT); setUserMessage("article_saved"); }
|
public void storeArticle() { String bref = WFPage.CONTENT_BUNDLE + "."; //boolean storeOk = ((Boolean) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "storeArticle")).booleanValue(); boolean storeOk = getArticleItemBean().storeArticle().booleanValue(); if (!storeOk) { //List errorKeys = (List) WFUtil.getValue(ARTICLE_ITEM_BEAN_ID, "errorKeys"); List errorKeys = getArticleItemBean().getErrorKeys(); if (errorKeys != null) { for (Iterator iter = errorKeys.iterator(); iter.hasNext();) { String errorKey = (String) iter.next(); WFUtil.addMessageVB(findComponent(SAVE_ID), bref + errorKey); } } return; } setEditMode(EDIT_MODE_EDIT); setUserMessage("article_saved"); }
| 1,122,182
|
public void storeArticle() { String bref = WFPage.CONTENT_BUNDLE + "."; //boolean storeOk = ((Boolean) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "storeArticle")).booleanValue(); boolean storeOk = getArticleItemBean().storeArticle().booleanValue(); if (!storeOk) { //List errorKeys = (List) WFUtil.getValue(ARTICLE_ITEM_BEAN_ID, "errorKeys"); List errorKeys = getArticleItemBean().getErrorKeys(); if (errorKeys != null) { for (Iterator iter = errorKeys.iterator(); iter.hasNext();) { String errorKey = (String) iter.next(); WFUtil.addMessageVB(findComponent(SAVE_ID), bref + errorKey); } } return; } setEditMode(EDIT_MODE_EDIT); setUserMessage("article_saved"); }
|
public void storeArticle() { String bref = WFPage.CONTENT_BUNDLE + "."; //boolean storeOk = ((Boolean) WFUtil.invoke(ARTICLE_ITEM_BEAN_ID, "storeArticle")).booleanValue(); boolean storeOk = getArticleItemBean().storeArticle().booleanValue(); if (!storeOk) { //List errorKeys = (List) WFUtil.getValue(ARTICLE_ITEM_BEAN_ID, "errorKeys"); List errorKeys = getArticleItemBean().getErrorKeys(); if (errorKeys != null) { for (Iterator iter = errorKeys.iterator(); iter.hasNext();) { String errorKey = (String) iter.next(); WFUtil.addMessageVB(findComponent(SAVE_ID), bref + errorKey); } } return; } setEditMode(EDIT_MODE_EDIT); setUserMessage("article_saved"); }
| 1,122,183
|
public void registerDirective(String name, String clazz) throws Exception { DirectiveProvider dp = (DirectiveProvider) _wm.getBroker().getProvider(DirectiveProvider.DIRECTIVE_KEY); dp.register(clazz, name); }
|
public void registerDirective(String name, String clazz) throws Exception { DirectiveProvider dp = (DirectiveProvider) _wm.getBroker().getProvider(DirectiveProvider.DIRECTIVE_KEY); dp.registerDirective(clazz, name); }
| 1,122,184
|
public void assertStringTemplateThrows (String templateText, Class exceptionClass) throws Exception { assertStringTemplateThrows(templateText, exceptionClass, null); }
|
public void assertStringTemplateThrows (String templateText, Class exceptionClass, String messageMatchText) throws Exception { assertStringTemplateThrows(templateText, exceptionClass, null); }
| 1,122,185
|
public void assertStringTemplateThrows (String templateText, Class exceptionClass) throws Exception { assertStringTemplateThrows(templateText, exceptionClass, null); }
|
public void assertStringTemplateThrows (String templateText, Class exceptionClass) throws Exception { String result = null; Exception caught = null; try { result = executeStringTemplate(templateText); } catch (Exception e) { caught = e; } if (caught == null) { System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting throw " + exceptionClass); assertTrue(false); } else if (!exceptionClass.isAssignableFrom(caught.getClass())) { System.err.println("Execution of /" + templateText + "/" + " threw " + caught.getClass() + ", expecting " + exceptionClass); assertTrue(false); } else if (messageMatchText != null) { RE re = new RE(messageMatchText); if (!re.match(caught.getMessage())) { System.err.println("Exception " + caught.getMessage() + " does not match /" + messageMatchText + "/"); assertTrue(false); } } }
| 1,122,186
|
public void assertStringTemplateEquals (String templateText, String resultText) { String result = null; try { result = executeStringTemplate(templateText); } catch (Exception e) { System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); e.printStackTrace(); assertTrue(false); } if (result == null) return; if (!result.equals(resultText)) { System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting /" + resultText + "/"); assertTrue(false); } }
|
public void assertStringTemplateEquals (String templateText, String resultText) { String result = null; try { result = executeStringTemplate(templateText); } catch (Exception e) { System.err.println("Execution of /" + templateText + "/" + " threw " + e.getClass() + "(" + e.getMessage() + ")" + ", expecting /" + resultText + "/"); e.printStackTrace(); assertTrue(false); } if (result == null) return; if (!result.equals(resultText)) { System.err.println("Execution of /" + templateText + "/" + " yielded /" + result + "/, expecting /" + resultText + "/"); assertTrue(false); } }
| 1,122,187
|
public MappingMetaData(Properties properties) { this.properties = properties; this.packageName = properties.getProperty("package", ""); }
|
public MappingMetaData(Properties properties) { this.properties = properties; this.packageName = properties.getProperty("package", ""); }
| 1,122,188
|
public void initLog(Settings config) { String logFile = config.getSetting("LogFile"); if ((logFile == null || logFile.equals("")) && _config.getBooleanSetting("LogUsingServletLog")) _ls.addTarget(new ServletLog(_servletContext, _config)); else initLog(); }
|
public void initLog(Settings config) { String logFile = config.getSetting("LogFile"); if ((logFile == null || logFile.equals("")) && _config.getBooleanSetting("LogUsingServletLog")) addLogTarget(); else initLog(); }
| 1,122,189
|
public Broker(Properties config, String name) throws InitException { _lm = new LogManager(config); _log = _lm.getLog("broker"); _log.notice("start: " + name); _name = name; if (config == null) { _log.error("no configuration: perhaps some config file is missing? "); throw new InitException("No configuration supplied: " + "perhaps some configuration file could not be located?"); } _config = config; String providers = config.getProperty("Providers"); if (providers == null) { _log.error("configuration exists but has no Providers listed"); throw new InitException("No providers in configuration"); } Enumeration pen = new StringTokenizer(providers); Class pClass; Provider instance; while (pen.hasMoreElements()) { String className = (String) pen.nextElement(); try { pClass = Class.forName(className); instance = (Provider) pClass.newInstance(); addProvider(instance); _log.info("Loaded provider: " + className); } catch (Exception e) { _log.error("Provider (" + className + ") failed to load", e); } } }
|
public Broker(Properties config, String name) throws InitException { _lm = new LogManager(config); _log = _lm.getLog("broker"); _log.notice("start: " + name); _name = name; if (config == null) { _log.error("no configuration: perhaps some config file is missing? "); throw new InitException("No configuration supplied: " + "perhaps some configuration file could not be located?"); } _config = config; String providers = config.getProperty("Providers"); if (providers == null) { _log.error("configuration exists but has no Providers listed"); throw new InitException("No providers in configuration"); } Enumeration pen = new StringTokenizer(providers); Class pClass; Provider instance; while (pen.hasMoreElements()) { String className = (String) pen.nextElement(); try { pClass = Class.forName(className); instance = (Provider) pClass.newInstance(); addProvider(instance); _log.info("Loaded provider: " + className); } catch (Exception e) { _log.error("Provider (" + className + ") failed to load", e); } } }
| 1,122,190
|
public Broker(Properties config, String name) throws InitException { _lm = new LogManager(config); _log = _lm.getLog("broker"); _log.notice("start: " + name); _name = name; if (config == null) { _log.error("no configuration: perhaps some config file is missing? "); throw new InitException("No configuration supplied: " + "perhaps some configuration file could not be located?"); } _config = config; String providers = config.getProperty("Providers"); if (providers == null) { _log.error("configuration exists but has no Providers listed"); throw new InitException("No providers in configuration"); } Enumeration pen = new StringTokenizer(providers); Class pClass; Provider instance; while (pen.hasMoreElements()) { String className = (String) pen.nextElement(); try { pClass = Class.forName(className); instance = (Provider) pClass.newInstance(); addProvider(instance); _log.info("Loaded provider: " + className); } catch (Exception e) { _log.error("Provider (" + className + ") failed to load", e); } } }
|
public Broker(Properties config, String name) throws InitException { _lm = new LogManager(config); _log = _lm.getLog("broker"); _log.notice("start: " + name); _name = name; if (config == null) { _log.error("no configuration: perhaps some config file is missing? "); throw new InitException("No configuration supplied: " + "perhaps some configuration file could not be located?"); } _config = config; String providers = config.getProperty("Providers"); if (providers == null) { _log.error("configuration exists but has no Providers listed"); throw new InitException("No providers in configuration"); } Enumeration pen = new StringTokenizer(providers); Class pClass; Provider instance; while (pen.hasMoreElements()) { String className = (String) pen.nextElement(); try { pClass = Class.forName(className); instance = (Provider) pClass.newInstance(); addProvider(instance); _log.info("Loaded provider: " + className); } catch (Exception e) { _log.error("Provider (" + className + ") failed to load", e); } } }
| 1,122,191
|
public String getSourceFileName() { String baseName; if (sourceFileName != null) baseName = sourceFileName; else { int firstDollarSign = getBaseName().indexOf('$'); if (firstDollarSign == -1) baseName = getBaseName() + ".java"; else baseName = getBaseName().substring(0, firstDollarSign) + ".java"; } String packageName = getPackageName(); if ( packageName.equals("")) return baseName; return getPackageName().replace('.', '/') + '/' + baseName; }
|
public String getSourceFileName() { String baseName; if (sourceFileName != null) baseName = sourceFileName; else { int firstDollarSign = getBaseName().indexOf('$'); if (firstDollarSign == -1 || firstDollarSign == 0) baseName = getBaseName() + ".java"; else baseName = getBaseName().substring(0, firstDollarSign) + ".java"; } String packageName = getPackageName(); if ( packageName.equals("")) return baseName; return getPackageName().replace('.', '/') + '/' + baseName; }
| 1,122,193
|
public Parameters( Filter filter ) { this.filter = filter; }
|
public Parameters( Filter filter ) { this.filter = filter; }
| 1,122,194
|
public Log getLog(String type);
|
public Log getLog(String type, String description);
| 1,122,197
|
public WebContext(final Broker broker) { super(broker); try { String tools = (String) broker.getValue("config","TemplateTools"); registerTools(tools); } catch (InvalidTypeException it) { _log.exception(it); _log.error("config type not registered with broker!"); } catch (NotFoundException ne) { _log.exception(ne); _log.warning("could not load tools from config: " + ne); } }
|
public WebContext(final Broker broker) { super(broker); try { String tools = (String) broker.getValue("config","ContextTools"); registerTools(tools); } catch (InvalidTypeException it) { _log.exception(it); _log.error("config type not registered with broker!"); } catch (NotFoundException ne) { _log.exception(ne); _log.warning("could not load tools from config: " + ne); } }
| 1,122,198
|
public byte[] encode(String s) { int hash = s.hashCode() % _size; if (hash < 0) hash = -hash; Bucket b = _cache[hash]; synchronized (b) { if (b.string1 == s) return b.bytes1; else if (b.string2 == s) return b.bytes2; else if (b.string3 == s) return b.bytes3; else if (b.string4 == s) return b.bytes4; else if (b.string5 == s) return b.bytes5; else if (s == null) return null; try { byte[] buf = s.getBytes(_encoding); b.string5 = b.string4; b.string4 = b.string3; b.string3 = b.string2; b.string2 = b.string1; b.string1 = s; b.bytes5 = b.bytes4; b.bytes4 = b.bytes3; b.bytes3 = b.bytes2; b.bytes2 = b.bytes1; b.bytes1 = buf; ; return buf; } catch (UnsupportedEncodingException e) { e.printStackTrace(); // never happen: we check in ctor return null; } } }
|
public byte[] encode(String s) { int hash = s.hashCode() % _size; if (hash < 0) hash = -hash; Bucket b = _cache[hash]; synchronized (b) { if (b.string1 == s) return b.bytes1; else if (b.string2 == s) return b.bytes2; else if (b.string3 == s) return b.bytes3; else if (b.string4 == s) return b.bytes4; else if (b.string5 == s) return b.bytes5; else if (s == null) return null; try { byte[] buf = s.getBytes(_encoding); b.string5 = b.string4; b.string4 = b.string3; b.string3 = b.string2; b.string2 = b.string1; b.string1 = s; b.bytes5 = b.bytes4; b.bytes4 = b.bytes3; b.bytes3 = b.bytes2; b.bytes2 = b.bytes1; b.bytes1 = buf; ; return buf; } catch (UnsupportedEncodingException e) { e.printStackTrace(); // never happen: we check in ctor return null; } } }
| 1,122,199
|
public void nd_aid(RubyId id) { u3 = id; }
|
public RubyId nd_aid() { return (RubyId)u3; }
| 1,122,200
|
public void testFavs() throws Exception { FavoriteService fs = (FavoriteService) getBean("favoriteService"); Map favorites = fs.getFavorites(); assertNotNull(favorites); assertEquals(1, favorites.size()); assertEquals("Grey Goose", favorites.get("Dan")); }
|
public void testFavs() throws Exception { FavoriteService fs = (FavoriteService) getBean("favoriteService"); Map favorites = fs.getFavorites(); assertNotNull(favorites); assertEquals(2, favorites.size()); assertEquals("Grey Goose", favorites.get("Dan")); }
| 1,122,201
|
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); context.registerTool("testTool", new TestTool()); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
|
public static void main(String arg[]) { Log.traceExceptions(true); Log.setLevel(Log.ALL); Log.setTarget(System.err); if (arg.length != 0) { System.out.println("Enabling log types"); Log.enableTypes(arg); } // Build a context WebMacro wm = null; Context context = null; try { wm = new WM(); context = new Context(null); Object names[] = { "prop" }; context.setProperty(names, "Example property"); } catch (Exception e) { e.printStackTrace(); } try { context.put("helloworld", "Hello World"); context.put("hello", "Hello"); context.put("file", "include.txt"); TestObject[] fruits = { new TestObject("apple",false), new TestObject("lemon",true), new TestObject("pear",false), new TestObject("orange",true), new TestObject("watermelon",false), new TestObject("peach",false), new TestObject("lime",true) }; SelectList sl = new SelectList(fruits, 3); context.put("sl-fruits", sl); context.put("fruits", fruits); context.put("flipper", new TestObject("flip",false)); System.out.println("- - - - - - - - - - - - - - - - - - - -"); System.out.println("Context contains: helloWorld, hello, file, TestObject[] fruits, SelectList sl(fruits, 3), TestObject flipper"); System.out.println("- - - - - - - - - - - - - - - - - - - -"); Template t1 = new StreamTemplate(wm.getBroker(), new InputStreamReader(System.in)); t1.parse(); Writer w = new OutputStreamWriter(System.out); System.out.println("*** RESULT ***"); t1.write(w,context); w.close(); System.out.println("*** DONE ***"); //System.out.println(result); } catch (Exception e) { e.printStackTrace(); } }
| 1,122,203
|
public void execute() throws BuildException { if (namespace == null) { throw new BuildException("'namespace' must be specified"); } if (srcDir == null) { throw new BuildException("'srcDir' must be specified"); } if (destFile == null) { throw new BuildException("'destFile' must be specified"); } if (propertyEditorPaths != null) { List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath())); StringTokenizer paths = new StringTokenizer(propertyEditorPaths, " ,"); editorSearchPath.addAll(Collections.list(paths)); PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()])); } ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { String[] excludedClasses = null; if (this.excludedClasses != null) { excludedClasses = this.excludedClasses.split(" *, *"); } MappingLoader mappingLoader = new QdoxMappingLoader(namespace, getFiles(srcDir), excludedClasses); GeneratorPlugin[] plugins = new GeneratorPlugin[]{ new XmlMetadataGenerator(this, metaInfDir, destFile), new DocumentationGenerator(this, destFile), new XsdGenerator(this, destFile) }; // load the mappings Set namespaces = mappingLoader.loadNamespaces(); if (namespaces.isEmpty()) { System.out.println("Warning: no namespaces found!"); } // generate the files for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) { NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next(); for (int i = 0; i < plugins.length; i++) { GeneratorPlugin plugin = plugins[i]; plugin.generate(namespaceMapping); } } log("...done."); } catch (Exception e) { throw new BuildException(e); } finally { Thread.currentThread().setContextClassLoader(oldCL); } }
|
public void execute() throws BuildException { if (namespace == null) { throw new BuildException("'namespace' must be specified"); } if (srcDir == null) { throw new BuildException("'srcDir' must be specified"); } if (destFile == null) { throw new BuildException("'destFile' must be specified"); } if (propertyEditorPaths != null) { List editorSearchPath = new LinkedList(Arrays.asList(PropertyEditorManager.getEditorSearchPath())); StringTokenizer paths = new StringTokenizer(propertyEditorPaths, " ,"); editorSearchPath.addAll(Collections.list(paths)); PropertyEditorManager.setEditorSearchPath((String[]) editorSearchPath.toArray(new String[editorSearchPath.size()])); } ClassLoader oldCL = Thread.currentThread().getContextClassLoader(); Thread.currentThread().setContextClassLoader(getClass().getClassLoader()); try { String[] excludedClasses = null; if (this.excludedClasses != null) { excludedClasses = this.excludedClasses.split(" *, *"); } MappingLoader mappingLoader = new QdoxMappingLoader(namespace, getFiles(srcDir), excludedClasses); GeneratorPlugin[] plugins = new GeneratorPlugin[]{ new XmlMetadataGenerator(this, metaInfDir, destFile), new DocumentationGenerator(this, destFile), new XsdGenerator(this, destFile) }; // load the mappings Set namespaces = mappingLoader.loadNamespaces(); if (namespaces.isEmpty()) { System.out.println("Warning: no namespaces found!"); } // generate the files for (Iterator iterator = namespaces.iterator(); iterator.hasNext();) { NamespaceMapping namespaceMapping = (NamespaceMapping) iterator.next(); for (int i = 0; i < plugins.length; i++) { GeneratorPlugin plugin = plugins[i]; plugin.generate(namespaceMapping); } } log("...done."); } catch (Exception e) { throw new BuildException(e); } finally { Thread.currentThread().setContextClassLoader(oldCL); } }
| 1,122,204
|
public XmlMetadataGenerator(LogFacade log, String metaInfDir, File schema) { this.metaInfDir = metaInfDir; this.log = log; this.schema = schema; }
|
public XmlMetadataGenerator(String metaInfDir, File schema) { this.metaInfDir = metaInfDir; this.log = log; this.schema = schema; }
| 1,122,206
|
public XmlMetadataGenerator(LogFacade log, String metaInfDir, File schema) { this.metaInfDir = metaInfDir; this.log = log; this.schema = schema; }
|
public XmlMetadataGenerator(LogFacade log, String metaInfDir, File schema) { this.metaInfDir = metaInfDir; this.schema = schema; }
| 1,122,207
|
public DocumentationGenerator(LogFacade log, File destFile) { this.destFile = destFile; this.log = log; }
|
public DocumentationGenerator(File destFile) { this.destFile = destFile; this.log = log; }
| 1,122,208
|
public DocumentationGenerator(LogFacade log, File destFile) { this.destFile = destFile; this.log = log; }
|
public DocumentationGenerator(LogFacade log, File destFile) { this.destFile = destFile; }
| 1,122,209
|
public XsdGenerator(LogFacade log, File destFile) { this.destFile = destFile; this.log = log; }
|
public XsdGenerator(File destFile) { this.destFile = destFile; this.log = log; }
| 1,122,210
|
public XsdGenerator(LogFacade log, File destFile) { this.destFile = destFile; this.log = log; }
|
public XsdGenerator(LogFacade log, File destFile) { this.destFile = destFile; }
| 1,122,211
|
public void testHTMLReportValidity() throws Exception { // Serialize the current coverage data to disk ProjectData.saveGlobalProjectData(); String dataFileName = CoverageDataFileHandler.getDefaultDataFile().getAbsolutePath(); // Then we need to generate the HTML report String[] args = new String[] { "--format", "html", "--datafile", dataFileName, "--destination", PATH_TO_TEST_OUTPUT.getAbsolutePath(), PATH_TO_SOURCES.getAbsolutePath(), PATH_TO_SOURCES_2.getAbsolutePath() }; net.sourceforge.cobertura.reporting.Main.main(args); // Get all files from report directory String htmlFiles[] = PATH_TO_TEST_OUTPUT.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".html"); } }); Arrays.sort(htmlFiles); assertTrue(htmlFiles.length >= 5); // Assert that all required files are there String[] requiredFiles = { "index.html", "help.html", "frame-packages.html", "frame-summary.html", "frame-sourcefiles.html" }; for (int i = 0; i < requiredFiles.length; i++) { if (!containsFile(htmlFiles, requiredFiles[i])) { fail("File " + requiredFiles[i] + " not found among report files"); } } // Validate selected files String previousPrefix = "NONE"; for (int i = 0; i < htmlFiles.length; i++) { // Validate file if has prefix different than previous one, or is required file if (containsFile(requiredFiles, htmlFiles[i]) || !htmlFiles[i].startsWith(previousPrefix)) { JUnitXMLHelper.validate(new File(PATH_TO_TEST_OUTPUT, htmlFiles[i])); } if (htmlFiles[i].length() > 7) { previousPrefix = htmlFiles[i].substring(0, 7); } else { previousPrefix = htmlFiles[i]; } } // Mark that test was successful so report will be deleted testSuccessful = true; }
|
public void testHTMLReportValidity() throws Exception { // Serialize the current coverage data to disk ProjectData.saveGlobalProjectData(); String dataFileName = CoverageDataFileHandler.getDefaultDataFile().getAbsolutePath(); // Then we need to generate the HTML report String[] args = new String[] { "--format", "html", "--datafile", dataFileName, "--destination", PATH_TO_TEST_OUTPUT.getAbsolutePath(), PATH_TO_SOURCES.getAbsolutePath(), PATH_TO_SOURCES_2.getAbsolutePath() }; net.sourceforge.cobertura.reporting.Main.main(args); // Get all files from report directory String htmlFiles[] = PATH_TO_TEST_OUTPUT.list(new FilenameFilter() { public boolean accept(File dir, String name) { return name.endsWith(".html"); } }); Arrays.sort(htmlFiles); assertTrue(htmlFiles.length >= 5); // Assert that all required files are there String[] requiredFiles = { "index.html", "help.html", "frame-packages.html", "frame-summary.html", "frame-sourcefiles.html" }; for (int i = 0; i < requiredFiles.length; i++) { if (!containsFile(htmlFiles, requiredFiles[i])) { fail("File " + requiredFiles[i] + " not found among report files"); } } // Validate selected files String previousPrefix = "NONE"; for (int i = 0; i < htmlFiles.length; i++) { // Validate file if has prefix different than previous one, or is required file if (containsFile(requiredFiles, htmlFiles[i]) || !htmlFiles[i].startsWith(previousPrefix)) { JUnitXMLHelper.readXmlFile(new File(PATH_TO_TEST_OUTPUT, htmlFiles[i]), true); } if (htmlFiles[i].length() > 7) { previousPrefix = htmlFiles[i].substring(0, 7); } else { previousPrefix = htmlFiles[i]; } } // Mark that test was successful so report will be deleted testSuccessful = true; }
| 1,122,212
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("instrumentation", LongOpt.REQUIRED_ARGUMENT, null, 'i'); longOpts[2] = new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:i:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = new String(g.getOptarg()); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { throw new Exception("Error: format \"" + format + "\" must be either html or xml"); } break; case 'i': serializationFile = new File(g.getOptarg()); if (!serializationFile.exists()) { throw new Exception("Error: serialization file " + serializationFile + " does not exist"); } if (serializationFile.isDirectory()) { throw new Exception("Error: serialization file " + serializationFile + " cannot be a directory"); } break; case 'o': outputDir = new File(g.getOptarg()); if (outputDir.exists() && outputDir.isFile()) { throw new Exception("Error: destination directory " + outputDir + " already exists and is a file"); } outputDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { throw new Exception("Error: source directory " + sourceDir + " does not exist"); } if (sourceDir.isFile()) { throw new Exception("Error: source directory " + sourceDir + " should be a directory, not a file"); } break; } } if (logger.isDebugEnabled()) { logger.debug("format is " + format); logger.debug("serializationFile is " + serializationFile.getAbsolutePath()); logger.debug("outputDir is " + outputDir.getAbsolutePath()); logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); } InputStream is = null; ObjectInputStream objects = null; try { is = new FileInputStream(serializationFile); objects = new ObjectInputStream(is); Map coverageData = (Map)objects.readObject(); Coverage coverage = CoverageUnmarshaller.parse(coverageData); if (format.equalsIgnoreCase("xml")) { new XMLReport(coverage, outputDir, sourceDir); } else if (format.equalsIgnoreCase("html")) { new HTMLReport(coverage, outputDir, sourceDir); } } finally { if (is != null) is.close(); if (objects != null) objects.close(); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
|
public static void main(String[] args) throws Exception { long startTime = System.currentTimeMillis(); LongOpt[] longOpts = new LongOpt[4]; longOpts[0] = new LongOpt("format", LongOpt.REQUIRED_ARGUMENT, null, 'f'); longOpts[1] = new LongOpt("instrumentation", LongOpt.REQUIRED_ARGUMENT, null, 'i'); longOpts[2] = new LongOpt("output", LongOpt.REQUIRED_ARGUMENT, null, 'o'); longOpts[3] = new LongOpt("source", LongOpt.REQUIRED_ARGUMENT, null, 's'); Getopt g = new Getopt(Main.class.getName(), args, ":f:i:o:s:", longOpts); int c; while ((c = g.getopt()) != -1) { switch (c) { case 'f': format = new String(g.getOptarg()); if (!format.equalsIgnoreCase("html") && !format.equalsIgnoreCase("xml")) { throw new Exception("Error: format \"" + format + "\" must be either html or xml"); } break; case 'i': serializationFile = new File(g.getOptarg()); if (!serializationFile.exists()) { throw new Exception("Error: serialization file " + serializationFile + " does not exist"); } if (serializationFile.isDirectory()) { throw new Exception("Error: serialization file " + serializationFile + " cannot be a directory"); } break; case 'o': outputDir = new File(g.getOptarg()); if (outputDir.exists() && outputDir.isFile()) { throw new Exception("Error: destination directory " + outputDir + " already exists and is a file"); } outputDir.mkdirs(); break; case 's': sourceDir = new File(g.getOptarg()); if (!sourceDir.exists()) { throw new Exception("Error: source directory " + sourceDir + " does not exist"); } if (sourceDir.isFile()) { throw new Exception("Error: source directory " + sourceDir + " should be a directory, not a file"); } break; } } if (logger.isDebugEnabled()) { logger.debug("format is " + format); logger.debug("serializationFile is " + serializationFile.getAbsolutePath()); logger.debug("outputDir is " + outputDir.getAbsolutePath()); logger.debug("sourceDir is " + sourceDir.getAbsolutePath()); } InputStream is = null; ObjectInputStream objects = null; try { is = new FileInputStream(serializationFile); objects = new ObjectInputStream(is); Map coverageData = (Map)objects.readObject(); CoverageReport coverage = new CoverageReport(coverageData); if (format.equalsIgnoreCase("xml")) { new XMLReport(coverage, outputDir, sourceDir); } else if (format.equalsIgnoreCase("html")) { new HTMLReport(coverage, outputDir, sourceDir); } } finally { if (is != null) is.close(); if (objects != null) objects.close(); } long stopTime = System.currentTimeMillis(); System.out .println("Reporting time: " + (stopTime - startTime) + "ms"); }
| 1,122,213
|
public static boolean contentsEqual(File f1, File f2, boolean ignoreWhitespace) throws IOException { if (f1 == f2) return true; if (f1 == null && f2 == null) return true; if (f1 == null || f2 == null) return false; if (f1.exists() != f2.exists() && f1.isFile() != f2.isFile() && f1.isDirectory() != f2.isDirectory()) return false; if (!f1.exists()) return true; if (f1.isDirectory()) { final File[] files1 = f1.listFiles(); for (final File file1 : files1) { final File file2 = new File(f2, file1.getName()); if (!contentsEqual(file1, file2, ignoreWhitespace)) return false; } // TODO same quantity of files return true; } else { Reader r1 = null; Reader r2 = null; try { r1 = new FileReader(f1); r2 = new FileReader(f2); if (!IOUtils.contentsEqual(r1, r2, ignoreWhitespace)) return false; } finally { try { if (r1 != null) r1.close(); } catch (IOException ignored) { } try { if (r2 != null) r2.close(); } catch (IOException ignored) { } } return true; } }
|
public static boolean contentsEqual(File f1, File f2, boolean ignoreWhitespace) throws IOException { if (f1 == f2) return true; if (f1 == null && f2 == null) return true; if (f1 == null || f2 == null) return false; if (f1.exists() != f2.exists() && f1.isFile() != f2.isFile() && f1.isDirectory() != f2.isDirectory()) return false; if (!f1.exists()) return true; if (f1.isDirectory()) { final File[] files1 = f1.listFiles(); for (final File file1 : files1) { final File file2 = new File(f2, file1.getName()); if (!contentsEqual(file1, file2, ignoreWhitespace)) return false; } // TODO same quantity of files return true; } else { Reader r1 = null; Reader r2 = null; try { r1 = new FileReader(f1); r2 = new FileReader(f2); if (!IOUtils.contentsEqual(r1, r2, ignoreWhitespace)) return false; } finally { try { if (r1 != null) r1.close(); } catch (IOException ignored) { } try { if (r2 != null) r2.close(); } catch (IOException ignored) { } } return true; } }
| 1,122,216
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("Foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("Foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "Foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("#foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("Foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "Foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
| 1,122,219
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("Foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("Foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "Foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("Foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("#foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "Foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
| 1,122,220
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("Foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("Foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "Foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
|
public void write(FastWriter out, Context context) throws ContextException, IOException { Object l, limit, from; long loopLimit=-1, loopStart=1, loopIndex=0; l = list; while (l instanceof Macro) l = ((Macro) l).evaluate(context); if (limitExpr != null) { limit = limitExpr; while (limit instanceof Macro) limit = ((Macro) limit).evaluate(context); if (Expression.isNumber(limit)) loopLimit = Expression.numberValue(limit); else throw new ContextException("Foreach: Cannot evaluate limit"); } if (index != null && indexFromExpr != null) { from = indexFromExpr; while (from instanceof Macro) from = ((Macro) from).evaluate(context); if (Expression.isNumber(from)) loopStart = Expression.numberValue(from); else throw new ContextException("Foreach: Cannot evaluate loop start"); } try { if (l instanceof Object[]) { Object[] alist = (Object[]) l; for (int i = 0; i < alist.length; i++) { target.setValue(context, alist[i]); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } else { Iterator iter; try { iter = PropertyOperator.getIterator(l); } catch (Exception e) { throw new ContextException("The object used as the list of values in a foreach statement must have some way of returning a list type, or be a list type itself. See the documentation for PropertyOperator.getIterator() for more details. No such property was found on the supplied object: " + l + ": ", e); } while(iter.hasNext()) { target.setValue(context, iter.next()); if (index != null) index.setValue(context, new Long(loopIndex + loopStart)); body.write(out, context); ++loopIndex; if (loopLimit > 0 && loopIndex >= loopLimit) break; } } } catch (ContextException e) { String errorText = "#foreach: Unable to set list index"; context.getBroker().getLog("engine").error(errorText); writeWarning(errorText, out); } }
| 1,122,221
|
public Object getArg(int argId, BuildContext bc) throws BuildException { if (buildArgs == null) return null; else return buildArgs.getArg(argId, bc); }
|
public Object getArg(int argId) throws BuildException { if (buildArgs == null) return null; else return buildArgs.getArg(argId, bc); }
| 1,122,222
|
public Object getArg(int argId, BuildContext bc) throws BuildException { if (buildArgs == null) return null; else return buildArgs.getArg(argId, bc); }
|
public Object getArg(int argId, BuildContext bc) throws BuildException { if (buildArgs == null) return null; else return buildArgs.getArg(argId, bc); }
| 1,122,223
|
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object o = builder.getArg(PARSE_TEMPLATE, bc); if (o instanceof Macro) { template = (Macro) o; return this; } else try { return bc.getBroker().get("template", o.toString()); } catch (NotFoundException ne) { throw new BuildException("Template " + o + " not found: ", ne); } }
|
public Object build(DirectiveBuilder builder, BuildContext bc) throws BuildException { Object o = builder.getArg(PARSE_TEMPLATE, bc); if (o instanceof Macro) { template = (Macro) o; return this; } else try { return bc.getBroker().get("template", o.toString()); } catch (NotFoundException ne) { throw new BuildException("#parse: Template " + o + " not found: ", ne); } }
| 1,122,224
|
public void write(FastWriter out, Context context) throws ContextException, IOException { String fname = template.evaluate(context).toString(); try { Template tmpl = (Template) context.getBroker().get("template", fname); tmpl.write(out,context); } catch (IOException e) { String warning = "Error reading template: " + fname; context.getLog("engine").warning(warning, e); writeWarning(warning, out); } catch (Exception e) { String warning = "Template not found: " + fname; context.getLog("engine").warning(warning,e); writeWarning(warning, out); } }
|
public void write(FastWriter out, Context context) throws ContextException, IOException { String fname = template.evaluate(context).toString(); try { Template tmpl = (Template) context.getBroker().get("template", fname); tmpl.write(out,context); } catch (IOException e) { String warning = "#parse: Error reading template: " + fname; context.getLog("engine").warning(warning, e); writeWarning(warning, out); } catch (Exception e) { String warning = "Template not found: " + fname; context.getLog("engine").warning(warning,e); writeWarning(warning, out); } }
| 1,122,225
|
public void write(FastWriter out, Context context) throws ContextException, IOException { String fname = template.evaluate(context).toString(); try { Template tmpl = (Template) context.getBroker().get("template", fname); tmpl.write(out,context); } catch (IOException e) { String warning = "Error reading template: " + fname; context.getLog("engine").warning(warning, e); writeWarning(warning, out); } catch (Exception e) { String warning = "Template not found: " + fname; context.getLog("engine").warning(warning,e); writeWarning(warning, out); } }
|
public void write(FastWriter out, Context context) throws ContextException, IOException { String fname = template.evaluate(context).toString(); try { Template tmpl = (Template) context.getBroker().get("template", fname); tmpl.write(out,context); } catch (IOException e) { String warning = "Error reading template: " + fname; context.getLog("engine").warning(warning, e); writeWarning(warning, out); } catch (Exception e) { String warning = "#parse: Template not found: " + fname; context.getLog("engine").warning(warning,e); writeWarning(warning, out); } }
| 1,122,226
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
| 1,122,227
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
|
protected String getFile(Broker b, String name) throws PropertyException { try { url = b.getResource(name); if (url == null) throw makePropertyException("Resource not found by URL provider or Broker"); URLConnection conn = url.openConnection(); StringBuffer sb = new StringBuffer (); InputStream in = conn.getInputStream(); String enc = conn.getContentEncoding(); if (enc == null) enc = b.getSetting("TemplateEncoding"); int cnt=0; byte[] buff = new byte[4096]; while ( (cnt = in.read(buff)) > 0) { sb.append (new String (buff, 0, cnt, enc)); } in.close(); return sb.toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us url = b.getResource(name); if (url == null) throw makePropertyException("Resource not found by URL provider or Broker"); URLConnection conn = url.openConnection(); StringBuffer sb = new StringBuffer (); InputStream in = conn.getInputStream(); String enc = conn.getContentEncoding(); if (enc == null) enc = b.getSetting("TemplateEncoding"); int cnt=0; byte[] buff = new byte[4096]; while ( (cnt = in.read(buff)) > 0) { sb.append (new String (buff, 0, cnt, enc)); } in.close(); return sb.toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
| 1,122,228
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
| 1,122,229
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
|
protected String getFile(Broker b, String name) throws PropertyException { try { return b.get("url", name).toString(); } catch (ResourceException re) { try { try { // The UrlProvider knows, how to do this, // so let him do the work for us return b.get("url", name).toString(); } catch (NullPointerException npe) { throw npe; } catch (Exception e) { throw makePropertyException("Found by Broker, but could not be retrieved", e); } } catch (NullPointerException npe) { throw makePropertyException("Not found by url provider or broker"); } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from Broker", e); } } catch (Exception e) { throw makePropertyException("Unexpected exception while getting from url provider", e); } }
| 1,122,230
|
public void addClassData(ClassData classData) { // this method aggregates data if classData is an inner class // with the data from the top level class that it is contained in LOGGER.debug("addClassData: " + classData.getName()); String parentClassName = getClassNameIgnoreInner(classData.getName()); LOGGER.debug("\tparentClassName = " + parentClassName); String keyName = new ClassData(parentClassName).getBaseName(); LOGGER.debug("\tkeyName = " + keyName); ClassData parent = getClassData(classData.getName()); if (parent == null) { LOGGER.debug("\tno parent"); parent = new ClassData(parentClassName); } classData.merge(parent); // Each key is a class basename, stored as an String object. // Each value is information about the class, stored as a ClassData object. LOGGER.debug("putting " + keyName + " = " + classData.getName()); children.put(keyName, classData); }
|
public void addClassData(ClassData classData) { // this method aggregates data if classData is an inner class // with the data from the top level class that it is contained in LOGGER.debug("addClassData: " + classData.getName()); String parentClassName = getClassNameIgnoreInner(classData.getName()); LOGGER.debug("\tparentClassName = " + parentClassName); String keyName = new ClassData(parentClassName).getBaseName(); LOGGER.debug("\tkeyName = " + keyName); ClassData parent = getClassData(classData.getName()); if (parent == null) { LOGGER.debug("\tno parent"); parent = new ClassData(parentClassName); } classData.merge(parent); // Each key is a class basename, stored as an String object. // Each value is information about the class, stored as a ClassData object. LOGGER.debug("putting " + keyName + " = " + classData.getName()); children.put(keyName, classData); }
| 1,122,231
|
private void rest() { serviceNotificationErrorCalled = false; }
|
private void rest() { notificationCalled = false; }
| 1,122,232
|
public void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) { assertFalse(serviceNotificationErrorCalled); serviceNotificationErrorCalled = true; assertSame(SERVICE_MONITOR, serviceMonitor); assertSame(SERVICE_EVENT, serviceEvent); assertSame(THROWABLE, throwable); }
|
public void serviceNotificationError(ServiceMonitor serviceMonitor, ServiceEvent serviceEvent, Throwable throwable) { assertFalse(serviceNotificationErrorCalled); serviceNotificationErrorCalled = true; assertSame(SERVICE_MONITOR, serviceMonitor); assertSame(SERVICE_EVENT, serviceEvent); assertSame(THROWABLE, throwable); }
| 1,122,233
|
public void testDoubleAdd() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); // note the mock monitor asserts that it is only called once before requreing a reset assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); }
|
public void testDoubleAdd() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); // note the mock monitor asserts that it is only called once before requreing a reset assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); }
| 1,122,234
|
public void testDoubleAdd() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); // note the mock monitor asserts that it is only called once before requreing a reset assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); }
|
public void testDoubleAdd() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); // note the mock monitor asserts that it is only called once before requreing a reset assertNotificationCorrect(); }
| 1,122,235
|
public void testFireEvent() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
|
public void testFireEvent() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
| 1,122,236
|
public void testFireEvent() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
|
public void testFireEvent() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
| 1,122,237
|
public void testRemove() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); kernelMonitor1.rest(); kernelMonitor2.rest(); kernelMonitor3.rest(); kernelMonitor4.rest(); kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertFalse(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
|
public void testRemove() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); kernelMonitor1.rest(); kernelMonitor2.rest(); kernelMonitor3.rest(); kernelMonitor4.rest(); kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertFalse(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
| 1,122,238
|
public void testRemove() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); kernelMonitor1.rest(); kernelMonitor2.rest(); kernelMonitor3.rest(); kernelMonitor4.rest(); kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertFalse(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
|
public void testRemove() { kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor1); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor3); kernelMonitorBroadcaster.addKernelMonitor(kernelMonitor4); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); kernelMonitor1.rest(); kernelMonitor2.rest(); kernelMonitor3.rest(); kernelMonitor4.rest(); kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitor2); kernelMonitorBroadcaster.serviceNotificationError(SERVICE_MONITOR, SERVICE_EVENT, THROWABLE); assertTrue(kernelMonitor1.wasServiceNotificationErrorCalled()); assertFalse(kernelMonitor2.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor3.wasServiceNotificationErrorCalled()); assertTrue(kernelMonitor4.wasServiceNotificationErrorCalled()); }
| 1,122,239
|
public void testRemoveUnassociated() { kernelMonitorBroadcaster.removeKernelMonitor(kernelMonitor1); }
|
public void testRemoveUnassociated() { kernelMonitorBroadcaster.removeKernelMonitor(new MockKernelMonitor("unassociated monitor")); }
| 1,122,240
|
public void addKernelMonitor(KernelMonitor kernelMonitor) { kernelMonitors.add(kernelMonitor); }
|
public void addKernelMonitor(KernelMonitor kernelMonitor) { kernelMonitors.addIfAbsent(kernelMonitor); }
| 1,122,241
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); IWSlideService service = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath(); slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML(); System.out.println(article); rootResource.putMethod(session.getURI(filePath),article); rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e1) { storeOk = false; // TODO Auto-generated catch block e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); IWSlideService service = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); String filePath=getArticleResourcePath(); String articleFolderPath = getArticlePath(); slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML(); System.out.println(article); rootResource.putMethod(session.getURI(filePath),article); rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { // TODO Auto-generated catch block e.printStackTrace(); } } catch (IOException e1) { storeOk = false; // TODO Auto-generated catch block e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,243
|
public static String getArticleYearMonthPath() { IWTimestamp now = new IWTimestamp(); String folderString = ArticleUtil.getArticleRootPath()+"/"+now.getYear()+"/"+now.getDateString("MM"); return folderString; }
|
public static String getArticleYearMonthPath(String basePath) { IWTimestamp now = new IWTimestamp(); String folderString = ArticleUtil.getArticleRootPath()+"/"+now.getYear()+"/"+now.getDateString("MM"); return folderString; }
| 1,122,244
|
public static String getArticleYearMonthPath() { IWTimestamp now = new IWTimestamp(); String folderString = ArticleUtil.getArticleRootPath()+"/"+now.getYear()+"/"+now.getDateString("MM"); return folderString; }
|
public static String getArticleYearMonthPath() { IWTimestamp now = new IWTimestamp(); String folderString = basePath+"/"+now.getYear()+"/"+now.getDateString("MM"); return folderString; }
| 1,122,245
|
public void makeTabRed(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); Font font = tab.getTitleLabel().getFont(); tab.getTitleLabel().setForeground(Color.red); Font newFont = font.deriveFont(Font.BOLD); tab.getTitleLabel().setFont(newFont); } }
|
public void makeTabRed(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); Font font = tab.getTitleLabel().getFont(); final JLabel titleLabel = tab.getTitleLabel(); Font newFont = font.deriveFont(Font.BOLD); tab.getTitleLabel().setFont(newFont); } }
| 1,122,246
|
public void makeTabRed(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); Font font = tab.getTitleLabel().getFont(); tab.getTitleLabel().setForeground(Color.red); Font newFont = font.deriveFont(Font.BOLD); tab.getTitleLabel().setFont(newFont); } }
|
public void makeTabRed(final ChatRoom room) { final int index = indexOfComponent(room); if (index != -1) { SparkTab tab = getTabAt(index); Font font = tab.getTitleLabel().getFont(); tab.getTitleLabel().setForeground(Color.red); Font newFont = font.deriveFont(Font.BOLD); titleLabel.setFont(newFont); titleLabel.setForeground(Color.red); } }
| 1,122,247
|
public StatusItem getItemFromPresence(Presence presence) { // Handle offline presence if (presence == null) { return null; } Iterator statusItemIterator = dndList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if (presence.getStatus() != null && item.getPresence().getStatus() != null) { if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType()) && (presence.getStatus().equals(item.getPresence().getStatus()))) { return item; } } } statusItemIterator = dndList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType())) { return item; } } return null; }
|
public StatusItem getItemFromPresence(Presence presence) { // Handle offline presence if (presence == null) { return null; } Iterator statusItemIterator = statusList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if (presence.getStatus() != null && item.getPresence().getStatus() != null) { if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType()) && (presence.getStatus().equals(item.getPresence().getStatus()))) { return item; } } } statusItemIterator = dndList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType())) { return item; } } return null; }
| 1,122,248
|
public StatusItem getItemFromPresence(Presence presence) { // Handle offline presence if (presence == null) { return null; } Iterator statusItemIterator = dndList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if (presence.getStatus() != null && item.getPresence().getStatus() != null) { if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType()) && (presence.getStatus().equals(item.getPresence().getStatus()))) { return item; } } } statusItemIterator = dndList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType())) { return item; } } return null; }
|
public StatusItem getItemFromPresence(Presence presence) { // Handle offline presence if (presence == null) { return null; } Iterator statusItemIterator = statusList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if (presence.getStatus() != null && item.getPresence().getStatus() != null) { if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType()) && (presence.getStatus().equals(item.getPresence().getStatus()))) { return item; } } } statusItemIterator = statusList.iterator(); while (statusItemIterator.hasNext()) { StatusItem item = (StatusItem)statusItemIterator.next(); if ((presence.getMode() == item.getPresence().getMode()) && (presence.getType() == item.getPresence().getType())) { return item; } } return null; }
| 1,122,249
|
public NotFoundException(String reason) { super(reason); }
|
public NotFoundException(String reason) { super(reason); }
| 1,122,250
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,251
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,252
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } boolean hadToCreate = session.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,253
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); if(hadToCreate){ String fixedFolderURL = session.getURI(articleFolderPath); rootResource.proppatchMethod(fixedFolderURL,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } else{ rootResource.proppatchMethod(articleFolderPath,PROPERTY_CONTENT_TYPE,"LocalizedFile",true); } String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,254
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,255
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } rootResource.proppatchMethod(filePath,new PropertyName("IW:",CONTENT_TYPE),ARTICLE_FILENAME_SCOPE,true); rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
|
public void store() throws IDOStoreException{ boolean storeOk = true; clearErrorKeys(); if (getHeadline().trim().equals("")) { addErrorKey(KEY_ERROR_HEADLINE_EMPTY); storeOk = false; } if (getBody().trim().equals("")) { addErrorKey(KEY_ERROR_BODY_EMPTY); storeOk = false; } // if (getRequestedStatus() != null && getRequestedStatus().equals(ContentItemCase.STATUS_PUBLISHED)) {// if (getCase().getPublishedFromDate() == null) {// addErrorKey(KEY_ERROR_PUBLISHED_FROM_DATE_EMPTY);// storeOk = false;// }// } // String filename = getHeadline();// if(null==filename || filename.length()==0) {// filename = "empty";// } try { IWUserContext iwuc = IWContext.getInstance(); IWApplicationContext iwac = iwuc.getApplicationContext(); IWSlideSession session = (IWSlideSession)IBOLookup.getSessionInstance(iwuc,IWSlideSession.class); WebdavRootResource rootResource = session.getWebdavRootResource(); IWSlideService slideService = (IWSlideService)IBOLookup.getServiceInstance(iwac,IWSlideService.class); //Setting the path for creating new file/creating localized version/updating existing file String filePath=getResourcePath(); String articleFolderPath=getArticlePath(); if(articleFolderPath!=null) { filePath=articleFolderPath+"/"+getArticleName(); }else { filePath=getArticleResourcePath(); articleFolderPath = getArticlePath(); } slideService.createAllFoldersInPath(articleFolderPath); rootResource.proppatchMethod(articleFolderPath,new PropertyName("IW:",CONTENT_TYPE),"LocalizedFile",true); String article = getAsXML();// System.out.println(article); //Conflict fix: uri for creating but path for updating //Note! This is a patch to what seems to be a bug in WebDav //Apparently in verion below works in some cases and the other in other cases. //Seems to be connected to creating files in folders created in same tomcat session or similar //not quite clear... if(session.getExistence(filePath)){ if(!rootResource.putMethod(filePath,article)) { rootResource.putMethod(session.getURI(filePath),article); } } else { if(!rootResource.putMethod(session.getURI(filePath),article)) { rootResource.putMethod(filePath,article); } } else{ String fixedURL = session.getURI(filePath); rootResource.putMethod(fixedURL,article); rootResource.proppatchMethod(fixedURL,PROPERTY_CONTENT_TYPE,ARTICLE_FILENAME_SCOPE,true); } rootResource.close(); try { load(filePath); } catch (Exception e) { e.printStackTrace(); } } catch (IOException e1) { storeOk = false; e1.printStackTrace(); } if (storeOk) { if (getRequestedStatus() != null) { setStatus(getRequestedStatus()); setRequestedStatus(null); } }else { throw new ArticleStoreException(); } }
| 1,122,256
|
public ChatToolBar() { buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); rightPanel = new JPanel(); rightPanel.setOpaque(false); rightPanel.setLayout(new BorderLayout()); // Set Layout setLayout(new GridBagLayout()); buttonPanel.setOpaque(false); add(buttonPanel, new GridBagConstraints(1, 1, 1, 1, 0.0, 0.0, GridBagConstraints.NORTHWEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); setOpaque(false); }
|
public ChatToolBar() { buttonPanel = new JPanel(); buttonPanel.setLayout(new FlowLayout(FlowLayout.LEFT)); rightPanel = new JPanel(); rightPanel.setOpaque(false); rightPanel.setLayout(new BorderLayout()); // Set Layout setLayout(new GridBagLayout()); buttonPanel.setOpaque(false); add(buttonPanel, new GridBagConstraints(1, 1, 1, 1, 1.0, 0.0, GridBagConstraints.NORTHEAST, GridBagConstraints.NONE, new Insets(0, 0, 0, 0), 0, 0)); setOpaque(false); }
| 1,122,257
|
private void showAlert(Message message) { final String body = message.getBody(); String subject = message.getSubject(); StringBuffer buf = new StringBuffer(); if (subject != null) { buf.append(Res.getString("subject") + ": ").append(subject); buf.append("\n\n"); } buf.append(body); String host = SparkManager.getSessionManager().getServerAddress(); String from = message.getFrom() != null ? message.getFrom() : ""; final TranscriptWindow window = new TranscriptWindow(); window.insertCustomMessage(null, buf.toString()); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(window, BorderLayout.CENTER); p.setBorder(BorderFactory.createLineBorder(Color.lightGray)); SparkToaster toaster = new SparkToaster(); toaster.setDisplayTime(30000); toaster.setBorder(BorderFactory.createBevelBorder(0)); String title = host; if (!from.contains("@")) { ChatManager chatManager = SparkManager.getChatManager(); ChatContainer container = chatManager.getChatContainer(); ChatRoomImpl chatRoom = null; try { chatRoom = (ChatRoomImpl)container.getChatRoom(from); } catch (ChatRoomNotFoundException e) { chatRoom = new ChatRoomImpl(from, from, Res.getString("message.broadcast.from", from)); chatRoom.setTabIcon(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE)); chatRoom.setIconHandler(true); chatRoom.getBottomPanel().setVisible(false); chatRoom.getToolBar().setVisible(false); SparkManager.getChatManager().getChatContainer().addChatRoom(chatRoom); } chatRoom.insertMessage(message); container.makeTabRed(chatRoom); } else if (message.getFrom() != null) { String jid = StringUtils.parseBareAddress(from); String nickname = SparkManager.getUserManager().getUserNicknameFromJID(jid); ChatManager chatManager = SparkManager.getChatManager(); ChatContainer container = chatManager.getChatContainer(); ChatRoomImpl chatRoom = null; try { chatRoom = (ChatRoomImpl)container.getChatRoom(from); } catch (ChatRoomNotFoundException e) { chatRoom = new ChatRoomImpl(jid, nickname, Res.getString("message.broadcast.from", nickname)); chatRoom.setTabIcon(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE)); chatRoom.setIconHandler(true); SparkManager.getChatManager().getChatContainer().addChatRoom(chatRoom); } chatRoom.insertMessage(message); container.makeTabRed(chatRoom); chatRoom.addMessageListener(new MessageListener() { boolean waiting = true; public void messageReceived(ChatRoom room, Message message) { if (waiting) { useDefaultRoomSettings((ChatRoomImpl)room); waiting = false; } } public void messageSent(ChatRoom room, Message message) { if (waiting) { useDefaultRoomSettings((ChatRoomImpl)room); waiting = false; } } }); } }
|
private void showAlert(Message message) { final String body = message.getBody(); String subject = message.getSubject(); StringBuffer buf = new StringBuffer(); if (subject != null) { buf.append(Res.getString("subject") + ": ").append(subject); buf.append("\n\n"); } buf.append(body); String host = SparkManager.getSessionManager().getServerAddress(); String from = message.getFrom() != null ? message.getFrom() : ""; final TranscriptWindow window = new TranscriptWindow(); window.insertCustomMessage(null, buf.toString()); JPanel p = new JPanel(); p.setLayout(new BorderLayout()); p.add(window, BorderLayout.CENTER); p.setBorder(BorderFactory.createLineBorder(Color.lightGray)); SparkToaster toaster = new SparkToaster(); toaster.setDisplayTime(30000); toaster.setBorder(BorderFactory.createBevelBorder(0)); String title = host; if (!from.contains("@")) { ChatManager chatManager = SparkManager.getChatManager(); ChatContainer container = chatManager.getChatContainer(); ChatRoomImpl chatRoom = null; try { chatRoom = (ChatRoomImpl)container.getChatRoom(jid); } catch (ChatRoomNotFoundException e) { chatRoom = new ChatRoomImpl(from, from, Res.getString("message.broadcast.from", from)); chatRoom.setTabIcon(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE)); chatRoom.setIconHandler(true); chatRoom.getBottomPanel().setVisible(false); chatRoom.getToolBar().setVisible(false); SparkManager.getChatManager().getChatContainer().addChatRoom(chatRoom); } chatRoom.insertMessage(message); container.makeTabRed(chatRoom); } else if (message.getFrom() != null) { String jid = StringUtils.parseBareAddress(from); String nickname = SparkManager.getUserManager().getUserNicknameFromJID(jid); ChatManager chatManager = SparkManager.getChatManager(); ChatContainer container = chatManager.getChatContainer(); ChatRoomImpl chatRoom = null; try { chatRoom = (ChatRoomImpl)container.getChatRoom(jid); } catch (ChatRoomNotFoundException e) { chatRoom = new ChatRoomImpl(jid, nickname, Res.getString("message.broadcast.from", nickname)); chatRoom.setTabIcon(SparkRes.getImageIcon(SparkRes.INFORMATION_IMAGE)); chatRoom.setIconHandler(true); SparkManager.getChatManager().getChatContainer().addChatRoom(chatRoom); } chatRoom.insertMessage(message); container.makeTabRed(chatRoom); chatRoom.addMessageListener(new MessageListener() { boolean waiting = true; public void messageReceived(ChatRoom room, Message message) { if (waiting) { useDefaultRoomSettings((ChatRoomImpl)room); waiting = false; } } public void messageSent(ChatRoom room, Message message) { if (waiting) { useDefaultRoomSettings((ChatRoomImpl)room); waiting = false; } } }); } }
| 1,122,258
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
| 1,122,259
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
|
public String getInput(String title, String description, Icon icon, Component parent) { textArea = new JTextArea(); textArea.setLineWrap(true); TitlePanel titlePanel = new TitlePanel(title, description, icon, true); // Construct main panel w/ layout. final JPanel mainPanel = new JPanel(); mainPanel.setLayout(new BorderLayout()); mainPanel.add(titlePanel, BorderLayout.NORTH); // The user should only be able to close this dialog. final Object[] options = {"Ok", "Cancel"}; optionPane = new JOptionPane(new JScrollPane(textArea), JOptionPane.PLAIN_MESSAGE, JOptionPane.OK_CANCEL_OPTION, null, options, options[0]); mainPanel.add(optionPane, BorderLayout.CENTER); // Let's make sure that the dialog is modal. Cannot risk people // losing this dialog. JOptionPane p = new JOptionPane(); dialog = p.createDialog(parent, title); dialog.setModal(true); dialog.pack(); dialog.setSize(width, height); dialog.setContentPane(mainPanel); dialog.setLocationRelativeTo(parent); optionPane.addPropertyChangeListener(this); // Add Key Listener to Send Field textArea.addKeyListener(new KeyAdapter() { public void keyPressed(KeyEvent e) { if (e.getKeyChar() == KeyEvent.VK_TAB) { optionPane.requestFocus(); } else if (e.getKeyChar() == KeyEvent.VK_ESCAPE) { dialog.dispose(); } } }); textArea.requestFocus(); dialog.setVisible(true); return stringValue; }
| 1,122,260
|
public RolloverButton(Icon icon) { super(icon); decorate(); }
|
public RolloverButton(Icon icon) { super(icon); decorate(); }
| 1,122,261
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); RosterEntry entry = roster.getEntry(participantJID); tabIcon = SparkManager.getUserManager().getTabIconForPresence(presence); PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText(Res.getString("message.view.information.about.this.user")); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText(Res.getString("message.add.this.user.to.your.roster")); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
|
public ChatRoomImpl(final String participantJID, String participantNickname, String title) { this.participantJID = participantJID; this.participantNickname = participantNickname; AndFilter presenceFilter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(this.participantJID)); // Register PacketListeners AndFilter messageFilter = new AndFilter(new PacketTypeFilter(Message.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(this, messageFilter); SparkManager.getConnection().addPacketListener(this, presenceFilter); // The roomname will be the participantJID this.roomname = participantJID; // Use the agents username as the Tab Title this.tabTitle = title; // The name of the room will be the node of the user jid + conversation. final SimpleDateFormat formatter = new SimpleDateFormat("h:mm a"); this.roomTitle = participantNickname; // Add RoomInfo this.getSplitPane().setRightComponent(null); getSplitPane().setDividerSize(0); roster = SparkManager.getConnection().getRoster(); presence = roster.getPresence(participantJID); RosterEntry entry = roster.getEntry(participantJID); tabIcon = SparkManager.getUserManager().getTabIconForPresence(presence); PacketFilter filter = new AndFilter(new PacketTypeFilter(Presence.class), new FromContainsFilter(participantJID)); SparkManager.getConnection().addPacketListener(new PacketListener() { public void processPacket(Packet packet) { presence = (Presence)packet; } }, filter); // Create toolbar buttons. ChatRoomButton infoButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.PROFILE_IMAGE_24x24)); infoButton.setToolTipText(Res.getString("message.view.information.about.this.user")); // Create basic toolbar. getToolBar().addChatRoomButton(infoButton); // If the user is not in the roster, then allow user to add them. if (entry == null && !StringUtils.parseResource(participantJID).equals(participantNickname)) { ChatRoomButton addToRosterButton = new ChatRoomButton("", SparkRes.getImageIcon(SparkRes.ADD_IMAGE_24x24)); addToRosterButton.setToolTipText(Res.getString("message.add.this.user.to.your.roster")); getToolBar().addChatRoomButton(addToRosterButton); addToRosterButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { RosterDialog rosterDialog = new RosterDialog(); rosterDialog.setDefaultJID(participantJID); rosterDialog.setDefaultNickname(getParticipantNickname()); rosterDialog.showRosterDialog(SparkManager.getChatManager().getChatContainer().getChatFrame()); } }); } // Show VCard. infoButton.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { VCardManager vcard = SparkManager.getVCardManager(); vcard.viewProfile(participantJID, SparkManager.getChatManager().getChatContainer()); } }); // If this is a private chat from a group chat room, do not show toolbar. if (StringUtils.parseResource(participantJID).equals(participantNickname)) { getToolBar().setVisible(false); } typingTimer = new Timer(2000, new ActionListener() { public void actionPerformed(ActionEvent e) { long now = System.currentTimeMillis(); if (now - lastTypedCharTime > 2000) { if (!sendNotification) { // send cancel SparkManager.getMessageEventManager().sendCancelledNotification(getParticipantJID(), threadID); sendNotification = true; } } } }); typingTimer.start(); // Add message event request listener messageEventRequestListener = new ChatMessageEventRequestListener(); SparkManager.getMessageEventManager().addMessageEventRequestListener(messageEventRequestListener); lastActivity = System.currentTimeMillis(); // Add VCard Panel final VCardPanel vcardPanel = new VCardPanel(participantJID); getToolBar().add(vcardPanel, new GridBagConstraints(0, 1, 1, 1, 1.0, 0.0, GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(5, 5, 5, 5), 0, 0)); }
| 1,122,262
|
private void generateSourceFile(SourceFileData sourceFileData) throws IOException { if (!sourceFileData.containsInstrumentationInfo()) { logger.info("Data file does not contain instrumentation " + "information for the file " + sourceFileData.getName() + ". Ensure this class was instrumented, and this " + "data file contains the instrumentation information."); } String filename = sourceFileData.getNormalizedName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = sourceFileData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(sourceFileData.getPackageName() + "."); } out.print(sourceFileData.getBaseName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeader("Classes in this File", false)); // TODO: Change this to actually show multiple classes. out.println(generateTableRowForSourceFile(sourceFileData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = finder.findFile(sourceFileData.getName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (sourceFileData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = sourceFileData .getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
|
private void generateSourceFile(SourceFileData sourceFileData) throws IOException { if (!sourceFileData.containsInstrumentationInfo()) { LOGGER.info("Data file does not contain instrumentation " + "information for the file " + sourceFileData.getName() + ". Ensure this class was instrumented, and this " + "data file contains the instrumentation information."); } String filename = sourceFileData.getNormalizedName() + ".html"; File file = new File(destinationDir, filename); PrintStream out = null; try { out = new PrintStream(new FileOutputStream(file)); out.println("<html>"); out.println("<head>"); out.println("<title>Coverage Report</title>"); out .println("<link title=\"Style\" type=\"text/css\" rel=\"stylesheet\" href=\"css/main.css\" />"); out .println("<script type=\"text/javascript\" src=\"js/popup.js\"></script>"); out.println("</head>"); out.println("<body>"); out.print("<h5>Coverage Report - "); String classPackageName = sourceFileData.getPackageName(); if ((classPackageName != null) && classPackageName.length() > 0) { out.print(sourceFileData.getPackageName() + "."); } out.print(sourceFileData.getBaseName()); out.println("</h5>"); // Output the coverage summary for this class out.println("<p>"); out.println("<table class=\"report\">"); out.println(generateTableHeader("Classes in this File", false)); // TODO: Change this to actually show multiple classes. out.println(generateTableRowForSourceFile(sourceFileData)); out.println("</table>"); out.println("</p>"); // Output this class's source code with syntax and coverage highlighting out.println("<p>"); out .println("<table cellspacing=\"0\" cellpadding=\"0\" class=\"src\">"); BufferedReader br = null; try { File sourceFile = finder.findFile(sourceFileData.getName()); br = new BufferedReader(new FileReader(sourceFile)); String lineStr; JavaToHtml javaToHtml = new JavaToHtml(); int lineNumber = 1; while ((lineStr = br.readLine()) != null) { out.println("<tr>"); if (sourceFileData.isValidSourceLineNumber(lineNumber)) { long numberOfHits = sourceFileData .getHitCount(lineNumber); out.println(" <td class=\"numLineCover\"> " + lineNumber + "</td>"); if (numberOfHits > 0) { out .println(" <td class=\"nbHitsCovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } else { out .println(" <td class=\"nbHitsUncovered\"> " + numberOfHits + "</td>"); out .println(" <td class=\"src\"><pre class=\"src\"><span class=\"srcUncovered\"> " + javaToHtml.process(lineStr) + "</span></pre></td>"); } } else { out.println(" <td class=\"numLine\"> " + lineNumber + "</td>"); out.println(" <td class=\"nbHits\"> </td>"); out .println(" <td class=\"src\"><pre class=\"src\"> " + javaToHtml.process(lineStr) + "</pre></td>"); } out.println("</tr>"); lineNumber++; } } finally { if (br != null) { br.close(); } } out.println("</table>"); out.println("</p>"); out.println("<div class=\"footer\">"); out .println("Reports generated by <a href=\"http://cobertura.sourceforge.net/\" target=\"_top\">Cobertura</a>."); out.println("</div>"); out.println("</body>"); out.println("</html>"); } finally { if (out != null) { out.close(); } } }
| 1,122,264
|
private void generateSourceFiles() { Iterator iter = projectData.getSourceFiles().iterator(); while (iter.hasNext()) { SourceFileData sourceFileData = (SourceFileData)iter.next(); try { generateSourceFile(sourceFileData); } catch (IOException e) { logger.info("Could not generate HTML file for source file " + sourceFileData.getName() + ": " + e.getLocalizedMessage()); } } }
|
private void generateSourceFiles() { Iterator iter = projectData.getSourceFiles().iterator(); while (iter.hasNext()) { SourceFileData sourceFileData = (SourceFileData)iter.next(); try { generateSourceFile(sourceFileData); } catch (IOException e) { LOGGER.info("Could not generate HTML file for source file " + sourceFileData.getName() + ": " + e.getLocalizedMessage()); } } }
| 1,122,265
|
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; double ccn = 0;//Util.getCCN(finder.findFile(packageData.getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getNumberOfChildren() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
|
private String generateTableRowForPackage(PackageData packageData) { StringBuffer ret = new StringBuffer(); String url1 = "frame-summary-" + packageData.getName() + ".html"; String url2 = "frame-sourcefiles-" + packageData.getName() + ".html"; double lineCoverage = -1; double branchCoverage = -1; File[] files = finder.findDirectory(packageData.getSourceFileName()); if (files.length == 0) { LOGGER.warn("No directories found for package: " + packageData.getSourceFileName()); } double ccnSum = 0; for (int i = 0; i < files.length; i++) { ccnSum += Util.getCCN(files[i], false); } double ccn = ccnSum / (double) files.length;//Util.getCCN(finder.findFile(packageData.getSourceFileName()), false); if (packageData.getNumberOfValidLines() > 0) lineCoverage = packageData.getLineCoverageRate(); if (packageData.getNumberOfValidBranches() > 0) branchCoverage = packageData.getBranchCoverageRate(); ret.append(" <tr>"); ret.append("<td class=\"text\"><a href=\"" + url1 + "\" onClick='parent.sourceFileList.location.href=\"" + url2 + "\"'>" + generatePackageName(packageData) + "</a></td>"); ret.append("<td class=\"value\">" + packageData.getNumberOfChildren() + "</td>"); ret.append(generateTableColumnsFromData(lineCoverage, branchCoverage, ccn)); ret.append("</tr>"); return ret.toString(); }
| 1,122,266
|
public File findFile(String filePart) { compute(); List mine = Collections.EMPTY_LIST; synchronized(this) { mine = new ArrayList(cached); } for (Iterator it = mine.iterator(); it.hasNext(); ) { String path = (String) it.next(); if (path.replace('/', '\\').endsWith(filePart.replace('/', '\\'))) { return new File(path); } } return null; }
|
public File findFile(String filePart) { compute(); List mine = Collections.EMPTY_LIST; synchronized(this) { mine = new ArrayList(cached); } for (Iterator it = mine.iterator(); it.hasNext(); ) { String path = (String) it.next(); if (path.replace('/', '\\').endsWith(filePart.replace('/', '\\'))) { return new File(path); } } return null; }
| 1,122,267
|
final protected void registerTool(String name, ContextTool tool) throws InvalidContextException { if (_toolbox == null) { _toolbox = new HashMap(); } _toolbox.put(name,tool); }
|
final public void registerTool(String name, ContextTool tool) throws InvalidContextException { if (_toolbox == null) { _toolbox = new HashMap(); } _toolbox.put(name,tool); }
| 1,122,269
|
final protected void registerTools(String tools) { Enumeration tenum = new StringTokenizer(tools); while (tenum.hasMoreElements()) { String toolName = (String) tenum.nextElement(); try { Class toolType = Class.forName(toolName); String varName = findToolName(toolName); ContextTool tool = (ContextTool) toolType.newInstance(); registerTool(varName,tool); } catch (ClassCastException cce) { _log.exception(cce); _log.error("Tool class " + toolName + " newInstance returns invalid type."); } catch (ClassNotFoundException ce) { _log.exception(ce); _log.error("Tool class " + toolName + " not found: " + ce); } catch (IllegalAccessException ia) { _log.exception(ia); _log.error("Tool class and methods must be public for " + toolName + ": " + ia); } catch (InvalidContextException e) { _log.exception(e); _log.error("InvalidContextException thrown while registering " + "Tool: " + toolName); } catch (InstantiationException ie) { _log.exception(ie); _log.error("Tool class " + toolName + " must have a public zero " + "argument or default constructor: " + ie); } } }
|
final public void registerTools(String tools) { Enumeration tenum = new StringTokenizer(tools); while (tenum.hasMoreElements()) { String toolName = (String) tenum.nextElement(); try { Class toolType = Class.forName(toolName); String varName = findToolName(toolName); ContextTool tool = (ContextTool) toolType.newInstance(); registerTool(varName,tool); } catch (ClassCastException cce) { _log.exception(cce); _log.error("Tool class " + toolName + " newInstance returns invalid type."); } catch (ClassNotFoundException ce) { _log.exception(ce); _log.error("Tool class " + toolName + " not found: " + ce); } catch (IllegalAccessException ia) { _log.exception(ia); _log.error("Tool class and methods must be public for " + toolName + ": " + ia); } catch (InvalidContextException e) { _log.exception(e); _log.error("InvalidContextException thrown while registering " + "Tool: " + toolName); } catch (InstantiationException ie) { _log.exception(ie); _log.error("Tool class " + toolName + " must have a public zero " + "argument or default constructor: " + ie); } } }
| 1,122,270
|
final public boolean setProperty(final Object[] names, final Object value) throws PropertyException, InvalidContextException { if (names.length == 0) { return false; } else if (_bean == null) { return setLocal(names, value); } else { return PropertyOperator.setProperty(this,_bean,names,value); } }
|
final public boolean setProperty(final Object[] names, final Object value) throws PropertyException, InvalidContextException { if (names.length == 0) { return false; } else if (_bean == null) { return setLocal(names, value) || setTool(names, value); } else { return PropertyOperator.setProperty(this,_bean,names,value); } }
| 1,122,271
|
static final public Object getProperty( final Context context, final Object instance, final Object[] names, int start) throws PropertyException, SecurityException, InvalidContextException { try { return getOperator(instance.getClass()).getProperty( context,instance,names,start,names.length - 1); } catch (NoSuchMethodException e) { _log.exception(e); throw new PropertyException("No method to access property: " + e,e); } }
|
static final public Object getProperty( final Context context, final Object instance, final Object[] names, int start) throws PropertyException, SecurityException, InvalidContextException { try { if (instance == null) { return null; } else { return getOperator(instance.getClass()).getProperty( context,instance,names,start,names.length - 1); } catch (NoSuchMethodException e) { _log.exception(e); throw new PropertyException("No method to access property: " + e,e); } }
| 1,122,272
|
final public Object build(BuildContext bc) throws BuildException { ArrayList strings = new ArrayList((elements.size())); ArrayList macros = new ArrayList((elements.size())); int[] ln = new int[elements.size()]; int[] cn = new int[elements.size()]; Stack iterStack = new Stack(); StringBuffer s = new StringBuffer(); // flatten everything and view the content as being: // string (macro string)* string // store that as an array of strings and an array of // Macro objects and create a block. BlockIterator iter = new BBIterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof Builder) o = ((Builder) o).build(bc); if (o instanceof Block) { iterStack.push(iter); iter = ((Block) o).getBlockIterator(); } else { if (o instanceof Macro) { strings.add(s.toString()); s = new StringBuffer(); // do not reuse StringBuffer, // otherwise all strings will contain char[] of max length!! macros.add(o); // Now deal with the line numbers int size = macros.size(); if (ln.length < size) { ln = resizeIntArray(ln, ln.length * 2); cn = resizeIntArray(cn, cn.length * 2); } ln[size - 1] = iter.getLineNo(); cn[size - 1] = iter.getColNo(); } else if (o != null) { s.append(o.toString()); } } while (!iter.hasNext() && !iterStack.empty()) iter = (BlockIterator) iterStack.pop(); } strings.add(s.toString()); Macro finalMacros[] = (Macro[]) macros.toArray(mArray); String finalStrings[] = (String[]) strings.toArray(sArray); int finalLines[] = resizeIntArray(ln, macros.size()); int finalCols[] = resizeIntArray(cn, macros.size()); return new Block(name, finalStrings, finalMacros, ln, cn); }
|
final public Object build(BuildContext bc) throws BuildException { ArrayList strings = new ArrayList((elements.size())); ArrayList macros = new ArrayList((elements.size())); int[] ln = new int[elements.size()]; int[] cn = new int[elements.size()]; Stack iterStack = new Stack(); StringBuffer s = new StringBuffer(); // flatten everything and view the content as being: // string (macro string)* string // store that as an array of strings and an array of // Macro objects and create a block. BlockIterator iter = new BBIterator(); while (iter.hasNext()) { Object o = iter.next(); if (o instanceof Builder) o = ((Builder) o).build(bc); if (o instanceof Block) { iterStack.push(iter); iter = ((Block) o).getBlockIterator(); } else { if (o instanceof Macro) { strings.add(s.toString()); s = new StringBuffer(); // do not reuse StringBuffer, // otherwise all strings will contain char[] of max length!! macros.add(o); // Now deal with the line numbers int size = macros.size(); if (ln.length < size) { ln = resizeIntArray(ln, ln.length * 2); cn = resizeIntArray(cn, cn.length * 2); } ln[size - 1] = iter.getLineNo(); cn[size - 1] = iter.getColNo(); } else if (o != null) { s.append(o.toString()); } } while (!iter.hasNext() && !iterStack.empty()) iter = (BlockIterator) iterStack.pop(); } strings.add(s.toString()); Macro finalMacros[] = (Macro[]) macros.toArray(mArray); String finalStrings[] = (String[]) strings.toArray(sArray); int finalLines[] = resizeIntArray(ln, macros.size()); int finalCols[] = resizeIntArray(cn, macros.size()); return new Block(name, finalStrings, finalMacros, finalLines, finalCols); }
| 1,122,275
|
public void clear() { Iterator i = _tools.entrySet().iterator(); while (i.hasNext()) { Map.Entry m = (Map.Entry) i.next(); ContextTool tool = (ContextTool) _toolbox.get(m.getKey()); tool.destroy(m.getValue()); } _tools.clear(); _globals.clear(); _bean = null; if (_prof != null) _prof.destroy(); }
|
public void clear() { Iterator i = _tools.entrySet().iterator(); while (i.hasNext()) { Map.Entry m = (Map.Entry) i.next(); ContextTool tool = (ContextTool) _toolbox.get(m.getKey()); tool.destroy(m.getValue()); } _tools.clear(); _globals.clear(); _bean = null; if (_prof != null) { stopTiming(); _prof.destroy(); } }
| 1,122,276
|
public Object saveState(FacesContext ctx) { Object values[] = new Object[2]; values[0] = super.saveState(ctx); values[1] = Boolean.valueOf(headlineAsLink); return values; }
|
public Object saveState(FacesContext ctx) { Object values[] = new Object[3]; values[0] = super.saveState(ctx); values[1] = Boolean.valueOf(headlineAsLink); return values; }
| 1,122,278
|
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws ServletException, IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = getFastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contact the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem, e); } return; } } boolean timing = false; try { context = newContext(req, resp); timing = Flags.PROFILE && context.isTiming(); if (timing) context.startTiming("WMServlet", req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { if (timing) context.stopTiming(); } if (t != null) { execute(t, context); } if (timing) context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req, resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + "<pre>" + e + "</pre>"); execute(tmpl, context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req, resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + "<pre>" + e + "</pre>"); execute(tmpl, context); } finally { if (timing) context.stopTiming(); context.recycle(); } }
|
final private void doRequest( HttpServletRequest req, HttpServletResponse resp) throws IOException { WebContext context = null; if (_problem != null) { init(); if (_problem != null) { try { resp.setContentType("text/html"); FastWriter out = getFastWriter(resp.getOutputStream(), resp.getCharacterEncoding()); out.write("<html><head><title>WebMacro Error</title></head>"); out.write("<body><h1><font color=\"red\">WebMacro Error: "); out.write("</font></h1><pre>"); out.write(_problem); out.write("</pre>"); out.write("Please contact the server administrator"); out.flush(); out.close(); } catch (Exception e) { _log.error(_problem, e); } return; } } boolean timing = false; try { context = newContext(req, resp); timing = Flags.PROFILE && context.isTiming(); if (timing) context.startTiming("WMServlet", req.getRequestURI()); Template t; try { if (timing) context.startTiming("handle"); t = handle(context); } finally { if (timing) context.stopTiming(); } if (t != null) { execute(t, context); } if (timing) context.startTiming("WMServlet.destroyContext()"); try { destroyContext(context); } finally { if (timing) context.stopTiming(); } } catch (HandlerException e) { if (context == null) { context = _wcPrototype.newInstance(req, resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "Your handler was unable to process the request successfully " + "for some reason. Here are the details:<p>" + "<pre>" + e + "</pre>"); execute(tmpl, context); } catch (Exception e) { if (context == null) { context = _wcPrototype.newInstance(req, resp); } _log.error("Your handler failed to handle the request:" + this, e); Template tmpl = error(context, "The handler WebMacro used to handle this request failed for " + "some reason. This is likely a bug in the handler written " + "for this application. Here are the details:<p>" + "<pre>" + e + "</pre>"); execute(tmpl, context); } finally { if (timing) context.stopTiming(); context.recycle(); } }
| 1,122,280
|
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.