Skip to content

Commit

Permalink
SAK-45649 Taggable: cover, Validator
Browse files Browse the repository at this point in the history
  • Loading branch information
axxter99 authored and Miguel Pellicer committed Jun 17, 2021
1 parent 64b110c commit 2c6ab27
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 34 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,6 @@

import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.exception.PermissionException;
import org.sakaiproject.taggable.api.Link;

/**
* The TaggingManager provides access to available
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import java.util.List;

import org.sakaiproject.component.cover.ComponentManager;
import org.sakaiproject.entity.cover.EntityManager;
import org.sakaiproject.entity.api.EntityManager;
import org.sakaiproject.entity.api.Entity;
import org.sakaiproject.entity.api.Reference;
import org.sakaiproject.exception.IdUnusedException;
Expand All @@ -34,7 +34,7 @@
import org.sakaiproject.site.api.Site;
import org.sakaiproject.site.api.SiteService;
import org.sakaiproject.taggable.api.TagColumn;
import org.sakaiproject.util.Validator;
import org.sakaiproject.util.api.FormattedText;

public class TagImpl implements Tag
{
Expand Down Expand Up @@ -65,16 +65,16 @@ public String getField(TagColumn column) {

protected String getField(String column) {
String field;
Reference ref = EntityManager.newReference(link.getTagCriteriaRef());
Reference ref = ComponentManager.get(EntityManager.class).newReference(link.getTagCriteriaRef());
Entity entity = ref.getEntity();

if (entity == null) return null;

FormattedText formattedText = ComponentManager.get(FormattedText.class);
if (TagList.WORKSITE.equals(column)) {
try
{
Site site = siteService.getSite(ref.getContext());
field = Validator.escapeHtml(site.getTitle());
field = formattedText.escapeHtml(site.getTitle());
}
catch (IdUnusedException e)
{
Expand All @@ -85,7 +85,7 @@ protected String getField(String column) {
} else if (TagList.PARENT.equals(column)) {
//field = link.getTagCriteria().getParentTitle();
//field = ">>>>PARENT TITLE SHOULD GO HERE<<<<";
field = Validator.escapeHtml((String)entity.getProperties().get(TagList.PARENT));
field = formattedText.escapeHtml((String)entity.getProperties().get(TagList.PARENT));
} else if (TagList.CRITERIA.equals(column)) {
//field = link.getTagCriteria().getTitle();
//field = ">>>>CRITERIA SHOULD GO HERE<<<<";
Expand All @@ -95,22 +95,22 @@ protected String getField(String column) {

field = (String)entity.getProperties().get(TagList.THICKBOX_INCLUDE);
field +="<a href=\"" + url + "\" class=\"thickbox\">";
field += Validator.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA));
field += formattedText.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA));
field += "</a>";
}
else
field = Validator.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA));
field = formattedText.escapeHtml((String)entity.getProperties().get(TagList.CRITERIA));

} else if (TagList.RUBRIC.equals(column)) {
field = Validator.escapeHtml(link.getRubric());
field = formattedText.escapeHtml(link.getRubric());
} else if (TagList.RATIONALE.equals(column)) {
field = Validator.escapeHtml(link.getRationale());
field = formattedText.escapeHtml(link.getRationale());
} else if (TagList.VISIBLE.equals(column)) {
field = Validator.escapeHtml(String.valueOf(link.isVisible()));
field = formattedText.escapeHtml(String.valueOf(link.isVisible()));
} else if (TagList.EXPORTABLE.equals(column)) {
field = Validator.escapeHtml(String.valueOf(link.isExportable()));
field = formattedText.escapeHtml(String.valueOf(link.isExportable()));
} else {
field = Validator.escapeHtml(TagListImpl.NA);
field = formattedText.escapeHtml(TagListImpl.NA);
}
return field;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@
import java.util.List;
import java.util.Map;

import lombok.Getter;
import lombok.Setter;
import lombok.extern.slf4j.Slf4j;

import org.sakaiproject.exception.PermissionException;
Expand All @@ -41,7 +43,7 @@
import org.sakaiproject.taggable.api.TaggableActivityProducer;
import org.sakaiproject.taggable.api.TaggingProvider;
import org.sakaiproject.user.api.User;
import org.sakaiproject.user.cover.UserDirectoryService;
import org.sakaiproject.user.api.UserDirectoryService;

@Slf4j
public class TaggingManagerImpl implements TaggingManager {
Expand All @@ -50,7 +52,8 @@ public class TaggingManagerImpl implements TaggingManager {

protected List<TaggingProvider> taggingProviders = new ArrayList<TaggingProvider>();

private LinkManager linkManager;
@Setter @Getter private LinkManager linkManager;
@Setter private UserDirectoryService userDirectoryService;

public void init() {
log.info("init()");
Expand Down Expand Up @@ -234,17 +237,9 @@ public TagColumn createTagColumn(String name, String displayName, String descrip
}

protected User getUser() {
return UserDirectoryService.getCurrentUser();
return userDirectoryService.getCurrentUser();
}

public LinkManager getLinkManager()
{
return linkManager;
}

public void setLinkManager(LinkManager linkManager)
{
this.linkManager = linkManager;
}

}
16 changes: 7 additions & 9 deletions taggable/taggable-impl/impl/src/webapp/WEB-INF/components.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,16 +14,14 @@
</property>
</bean>

<bean id="org.sakaiproject.taggable.api.TaggingManager"
class="org.sakaiproject.taggable.impl.TaggingManagerImpl"
init-method="init">

<property name="linkManager">
<ref bean="org.sakaiproject.taggable.api.LinkManager" />
</property>
<bean id="org.sakaiproject.taggable.api.TaggingManager"
class="org.sakaiproject.taggable.impl.TaggingManagerImpl"
init-method="init">
<property name="linkManager" ref="org.sakaiproject.taggable.api.LinkManager" />
<property name="userDirectoryService" ref="org.sakaiproject.user.api.UserDirectoryService"/>
</bean>
<bean id="org.sakaiproject.taggable.api.LinkManager"
<bean id="org.sakaiproject.taggable.api.LinkManager"
class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
<property name="transactionManager">
<ref bean="org.sakaiproject.springframework.orm.hibernate.GlobalTransactionManager" />
Expand Down

0 comments on commit 2c6ab27

Please sign in to comment.