CPD Results

The following document contains the results of PMD's CPD 4.2.5.

Duplications

FileLine
de/iqser/factory/classes/DefaultFactory.java31
de/iqser/factory/classes/HTMLFactory.java28
	}

	public String getDisplayTitle() {
		if( myContent == null) {
			return "initialize factory!";
		}
		Collection<Attribute> attributes = myContent.getAttributes();
		
		String title= null;
		for (Attribute attr : attributes) {
			// allowed attributes for the title are in this order: NAME, Title, that means NAME can overwrite Title
			
			if( attr.getName().equalsIgnoreCase("title")) {
				title= attr.getValue();
			}
			else if( attr.getName().equalsIgnoreCase("NAME")) {
				title= attr.getValue();
				break;		// no need to check other attributes
			}
		}
		return title;
	}
	
	public String getType() {
		if( myContent == null) {
			return "initialize factory!";
		}
		String type= myContent.getType();
		return type;
	}

	public String getModificationDate() {
		if( myContent == null) {
			return "initialize factory!";
		}
		SimpleDateFormat formatter= new SimpleDateFormat("dd.MM.yyyy");
		long timeMillis= myContent.getModificationDate();
		String formattedDate= formatter.format(timeMillis);
		return formattedDate;
	}

	public float getScore() {
		if( myContent == null) {
			return 0;
		}
		float score= myContent.getModificationDate();
		return score;
	}
	
	public String getURL() {
		if( myContent == null) {
			return "initialize factory!";
		}
		Collection<Attribute> attributes = myContent.getAttributes();
		String url= null;
		for (Attribute attr : attributes) {
			if( attr.getName().equalsIgnoreCase("PREVIEW_URL")) {
				url= attr.getValue();
				break;		// no need to check other attributes
			}
		}
		if( url == null) {
			url= myContent.getContentUrl();
		}
		if( _ilog.isInfoEnabled() ) {
			_ilog.info("Using url : " + url);
		}
		return url;
	}

	public List<String[]> getAttributes() {
		List<String[]> foundAttributes= new ArrayList<String[]>();
		Collection<Attribute> attributes = myContent.getAttributes();
		for (Attribute attr : attributes) {
			String name= attr.getName();
FileLine
de/iqser/portlets/SearchPortlet.java87
de/iqser/portlets/TreePortlet.java146
		super.processAction(actionRequest, actionResponse);
		
		String action= actionRequest.getParameter(PARAM_ACTION);
		if( action == null || !action.equals(ACTION_SEARCH) )  {
			return;	// probably a preferences action handled by base portlet
		}
		
		// remove old cached data, if any to force a reload in the display portlet
		HttpServletRequest servletRequest= PortalUtil.getHttpServletRequest( actionRequest);
		HttpSession servletSession= servletRequest.getSession();
		List<ContentBean> contentList= (List<ContentBean>) servletSession.getAttribute(DEIQSER_CACHED_DATA);
		if( contentList != null) {
			servletSession.removeAttribute(DEIQSER_CACHED_DATA);
		}
		List<BreadcrumbBean> relatedList= (List<BreadcrumbBean>) servletSession.getAttribute(DEIQSER_RELATED_LIST);
		if( relatedList != null) {
			servletSession.removeAttribute(DEIQSER_RELATED_LIST);
		}
		Set<String> selectedTypes= (Set<String>) servletSession.getAttribute(DisplayPortlet.DEIQSER_SELECTED_TYPES);
		if( selectedTypes != null) {
			servletSession.removeAttribute(DEIQSER_SELECTED_TYPES);
		}
		
		String searchInput= actionRequest.getParameter(PARAM_SEARCH_INPUT);
		if( searchInput != null) {
			searchInput= searchInput.trim();
			actionResponse.setRenderParameter(PUBLIC_RENDER_PARAM_SEARCH_INPUT, searchInput);
			// create a new list for breadcrumb
			BreadcrumbBean bcBean= new BreadcrumbBean();
			bcBean.setId(searchInput);
			bcBean.setDisplayName(searchInput);
			relatedList= new ArrayList<BreadcrumbBean>();
			relatedList.add(bcBean);
			servletSession.setAttribute(DEIQSER_RELATED_LIST, relatedList);
		
		}
FileLine
de/iqser/factory/classes/DMSFactory.java28
de/iqser/factory/classes/HTMLFactory.java28
	}

	public String getDisplayTitle() {
		if( myContent == null) {
			return "initialize factory!";
		}
		Collection<Attribute> attributes = myContent.getAttributes();
		
		String title= null;
		for (Attribute attr : attributes) {
			// allowed attributes for the title are in this order: NAME, Title, that means NAME can overwrite Title
			
			if( attr.getName().equalsIgnoreCase("title")) {
				title= attr.getValue();
			}
			else if( attr.getName().equalsIgnoreCase("NAME")) {
				title= attr.getValue();
				break;		// no need to check other attributes
			}
		}
		return title;
	}
	
	public String getType() {
		if( myContent == null) {
			return "initialize factory!";
		}
		String type= myContent.getType();
		return type;
	}

	public String getModificationDate() {
		if( myContent == null) {
			return "initialize factory!";
		}
		SimpleDateFormat formatter= new SimpleDateFormat("dd.MM.yyyy");
		long timeMillis= myContent.getModificationDate();
		String formattedDate= formatter.format(timeMillis);
		return formattedDate;
	}

	public float getScore() {
		if( myContent == null) {
			return 0;
		}
		float score= myContent.getModificationDate();
		return score;
	}
	
	public String getURL() {
		if( myContent == null) {
			return "initialize factory!";
		}
FileLine
de/iqser/factory/classes/DMSFactory.java143
de/iqser/factory/classes/HTMLFactory.java96
	}

	public List<String[]> getAttributes() {
		List<String[]> foundAttributes= new ArrayList<String[]>();
		Collection<Attribute> attributes = myContent.getAttributes();
		for (Attribute attr : attributes) {
			String name= attr.getName();
			String value= attr.getValue();
			if( value.length() > 200) {
				value= value.substring(0,200);
			}
			String[]arr= new String[2];
			arr[0]= name;
			arr[1]= value;
			foundAttributes.add(arr);
		}
		return foundAttributes;
	}

	public String getText() {
		if( myContent == null) {
			return "initialize factory!";
		}
		String fullText= myContent.getFulltext();
		return fullText;
	}

	public String getText(int maxLength) {
		// because we want the complete HTML, the maxLenght parameter is ignored here
		if( myContent == null) {
			return "initialize factory!";
		}
		String fullText= myContent.getFulltext();

		return fullText;
	}

}
FileLine
de/iqser/factory/classes/DMSFactory.java150
de/iqser/factory/classes/DefaultFactory.java122
			String value= attr.getValue();
			if( value.length() > 200) {
				value= value.substring(0,200);
			}
			String[]arr= new String[2];
			arr[0]= name;
			arr[1]= value;
			foundAttributes.add(arr);
		}
		return foundAttributes;
	}

	public String getText() {
		if( myContent == null) {
			return "initialize factory!";
		}
		String fullText= myContent.getFulltext();
		return fullText;
	}

	public String getText(int maxLength) {
		if( myContent == null) {
			return "initialize factory!";
		}
		String fullText= myContent.getFulltext();