mirror of
https://bitbucket.org/wisemapping/wisemapping-open-source.git
synced 2024-11-05 07:03:24 +01:00
remove classes of relationship
This commit is contained in:
parent
f3cc90d9d0
commit
d089b471fc
@ -1,14 +0,0 @@
|
|||||||
package com.wisemapping.dao;
|
|
||||||
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
|
|
||||||
public interface LabelMindmapManager {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
LabelMindmap getLabelMindmap(final int labelId, final int mindmapId);
|
|
||||||
|
|
||||||
void removeLabelMindmap(@NotNull LabelMindmap labelMindmap);
|
|
||||||
|
|
||||||
}
|
|
@ -1,30 +0,0 @@
|
|||||||
package com.wisemapping.dao;
|
|
||||||
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
import org.jetbrains.annotations.Nullable;
|
|
||||||
import org.springframework.orm.hibernate3.support.HibernateDaoSupport;
|
|
||||||
|
|
||||||
import java.util.List;
|
|
||||||
|
|
||||||
|
|
||||||
public class LabelMindmapManagerImpl extends HibernateDaoSupport
|
|
||||||
implements LabelMindmapManager {
|
|
||||||
|
|
||||||
@Nullable
|
|
||||||
@Override
|
|
||||||
public LabelMindmap getLabelMindmap(int labelId, int mindmapId) {
|
|
||||||
LabelMindmap result = null;
|
|
||||||
List<LabelMindmap> list = getHibernateTemplate().find("from com.wisemapping.model.LabelMindmap wisemapping where mindmap_id=? and label_id=? ", new Object[]{mindmapId, labelId});
|
|
||||||
assert list.size() <= 1;
|
|
||||||
if (list != null && !list.isEmpty()) {
|
|
||||||
result = list.get(0);
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeLabelMindmap(@NotNull LabelMindmap labelMindmap) {
|
|
||||||
getHibernateTemplate().delete(labelMindmap);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,37 +0,0 @@
|
|||||||
package com.wisemapping.rest;
|
|
||||||
|
|
||||||
|
|
||||||
import com.wisemapping.exceptions.LabelCouldNotFoundException;
|
|
||||||
import com.wisemapping.exceptions.LabelMindmapRelationshipNotFoundException;
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import com.wisemapping.rest.model.RestLabelMindmap;
|
|
||||||
import com.wisemapping.service.LabelMindmapService;
|
|
||||||
import org.springframework.beans.factory.annotation.Autowired;
|
|
||||||
import org.springframework.beans.factory.annotation.Qualifier;
|
|
||||||
import org.springframework.http.HttpStatus;
|
|
||||||
import org.springframework.stereotype.Controller;
|
|
||||||
import org.springframework.web.bind.annotation.*;
|
|
||||||
|
|
||||||
|
|
||||||
@Controller
|
|
||||||
public class LabelMindmapController extends BaseController {
|
|
||||||
|
|
||||||
@Qualifier("labelMindmapService")
|
|
||||||
@Autowired
|
|
||||||
private LabelMindmapService labelMindmapService;
|
|
||||||
|
|
||||||
@RequestMapping(method = RequestMethod.DELETE, value = "/labels/maps")
|
|
||||||
@ResponseStatus(value = HttpStatus.NO_CONTENT)
|
|
||||||
public void removeLabelFromMindmap(@RequestBody RestLabelMindmap restLabelMindmap) throws WiseMappingException {
|
|
||||||
final int labelId = restLabelMindmap.getLabelId();
|
|
||||||
final int mindmapId = restLabelMindmap.getMindmapId();
|
|
||||||
final LabelMindmap relationship = labelMindmapService.getLabelMindmap(labelId, mindmapId);
|
|
||||||
if (relationship == null) {
|
|
||||||
throw new LabelMindmapRelationshipNotFoundException("Label Map relation could not be found. Label Id: " + labelId + ", Map Id: " + mindmapId);
|
|
||||||
}
|
|
||||||
labelMindmapService.removeLabelFromMindmap(relationship);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
@ -1,47 +0,0 @@
|
|||||||
package com.wisemapping.rest.model;
|
|
||||||
import com.fasterxml.jackson.annotation.JsonIgnore;
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import org.codehaus.jackson.annotate.JsonAutoDetect;
|
|
||||||
import org.codehaus.jackson.annotate.JsonIgnoreProperties;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.NONE;
|
|
||||||
import static org.codehaus.jackson.annotate.JsonAutoDetect.Visibility.PUBLIC_ONLY;
|
|
||||||
|
|
||||||
@JsonAutoDetect(
|
|
||||||
fieldVisibility = NONE,
|
|
||||||
setterVisibility = PUBLIC_ONLY,
|
|
||||||
isGetterVisibility = NONE,
|
|
||||||
getterVisibility = PUBLIC_ONLY
|
|
||||||
)
|
|
||||||
@JsonIgnoreProperties(ignoreUnknown = true)
|
|
||||||
public class RestLabelMindmap {
|
|
||||||
|
|
||||||
@JsonIgnore
|
|
||||||
private LabelMindmap labelMindmap;
|
|
||||||
|
|
||||||
public RestLabelMindmap() {
|
|
||||||
this(new LabelMindmap());
|
|
||||||
}
|
|
||||||
|
|
||||||
public RestLabelMindmap(@NotNull final LabelMindmap labelMindmap) {
|
|
||||||
this.labelMindmap = labelMindmap;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setLabelId(final int labelId) {
|
|
||||||
this.labelMindmap.setLabelId(labelId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getLabelId() {
|
|
||||||
return this.labelMindmap.getLabelId();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setMindmapId(final int mindmapId) {
|
|
||||||
labelMindmap.setMindmapId(mindmapId);
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getMindmapId() {
|
|
||||||
return this.labelMindmap.getMindmapId();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
package com.wisemapping.service;
|
|
||||||
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
|
||||||
import com.wisemapping.model.Label;
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import com.wisemapping.model.Mindmap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
|
|
||||||
public interface LabelMindmapService {
|
|
||||||
|
|
||||||
void removeLabelFromMindmap(@NotNull final LabelMindmap labelMindmap) throws WiseMappingException;
|
|
||||||
|
|
||||||
LabelMindmap getLabelMindmap(int labelId, int mindmapId);
|
|
||||||
}
|
|
@ -1,25 +0,0 @@
|
|||||||
package com.wisemapping.service;
|
|
||||||
|
|
||||||
import com.wisemapping.dao.LabelMindmapManager;
|
|
||||||
import com.wisemapping.exceptions.WiseMappingException;
|
|
||||||
import com.wisemapping.model.LabelMindmap;
|
|
||||||
import org.jetbrains.annotations.NotNull;
|
|
||||||
|
|
||||||
public class LabelMindmapServiceImpl implements LabelMindmapService {
|
|
||||||
|
|
||||||
private LabelMindmapManager labelMindmapManager;
|
|
||||||
|
|
||||||
public void setLabelMindmapManager(LabelMindmapManager labelMindmapManager) {
|
|
||||||
this.labelMindmapManager = labelMindmapManager;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void removeLabelFromMindmap(@NotNull LabelMindmap labelMindmap) throws WiseMappingException {
|
|
||||||
this.labelMindmapManager.removeLabelMindmap(labelMindmap);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public LabelMindmap getLabelMindmap(int labelId, int mindmapId) {
|
|
||||||
return this.labelMindmapManager.getLabelMindmap(labelId, mindmapId);
|
|
||||||
}
|
|
||||||
}
|
|
@ -1,15 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<!DOCTYPE hibernate-mapping PUBLIC
|
|
||||||
"-//Hibernate/Hibernate Mapping DTD 3.0//EN"
|
|
||||||
"http://www.hibernate.org/dtd/hibernate-mapping-3.0.dtd">
|
|
||||||
|
|
||||||
<hibernate-mapping>
|
|
||||||
|
|
||||||
<class name="com.wisemapping.model.LabelMindmap" table="R_LABEL_MINDMAP">
|
|
||||||
<composite-id>
|
|
||||||
<key-property name="mindmapId" type="int" column="mindmap_id"/>
|
|
||||||
<key-property name="labelId" type="int" column="label_id" />
|
|
||||||
</composite-id>
|
|
||||||
</class>
|
|
||||||
|
|
||||||
</hibernate-mapping>
|
|
@ -34,7 +34,6 @@
|
|||||||
<value>com/wisemapping/model/AccessAuditory.hbm.xml</value>
|
<value>com/wisemapping/model/AccessAuditory.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
<value>com/wisemapping/model/MindMapHistory.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/Label.hbm.xml</value>
|
<value>com/wisemapping/model/Label.hbm.xml</value>
|
||||||
<value>com/wisemapping/model/LabelMindmap.hbm.xml</value>
|
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
<property name="hibernateProperties">
|
<property name="hibernateProperties">
|
||||||
|
@ -18,8 +18,5 @@
|
|||||||
<property name="hibernateTemplate" ref="hibernateTemplate"/>
|
<property name="hibernateTemplate" ref="hibernateTemplate"/>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="labelMindmapManager" class="com.wisemapping.dao.LabelMindmapManagerImpl">
|
|
||||||
<property name="hibernateTemplate" ref="hibernateTemplate"/>
|
|
||||||
</bean>
|
|
||||||
</beans>
|
</beans>
|
||||||
</beans>
|
</beans>
|
@ -45,7 +45,6 @@
|
|||||||
<value>com.wisemapping.rest.model.RestLogItem</value>
|
<value>com.wisemapping.rest.model.RestLogItem</value>
|
||||||
<value>com.wisemapping.rest.model.RestLockInfo</value>
|
<value>com.wisemapping.rest.model.RestLockInfo</value>
|
||||||
<value>com.wisemapping.rest.model.RestLabel</value>
|
<value>com.wisemapping.rest.model.RestLabel</value>
|
||||||
<value>com.wisemapping.rest.model.RestLabelMindmap</value>
|
|
||||||
</list>
|
</list>
|
||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
@ -72,22 +72,6 @@
|
|||||||
</property>
|
</property>
|
||||||
</bean>
|
</bean>
|
||||||
|
|
||||||
<bean id="labelMindmapServiceTarget" class="com.wisemapping.service.LabelMindmapServiceImpl">
|
|
||||||
<property name="labelMindmapManager" ref="labelMindmapManager"/>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="labelMindmapService" class="org.springframework.transaction.interceptor.TransactionProxyFactoryBean">
|
|
||||||
<property name="transactionManager" ref="transactionManager"/>
|
|
||||||
<property name="target">
|
|
||||||
<ref local="labelMindmapServiceTarget"/>
|
|
||||||
</property>
|
|
||||||
<property name="transactionAttributes">
|
|
||||||
<props>
|
|
||||||
<prop key="*">PROPAGATION_REQUIRED</prop>
|
|
||||||
</props>
|
|
||||||
</property>
|
|
||||||
</bean>
|
|
||||||
|
|
||||||
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
|
<bean id="mailSender" class="org.springframework.mail.javamail.JavaMailSenderImpl">
|
||||||
<property name="host" value="${mail.smtp.host}"/>
|
<property name="host" value="${mail.smtp.host}"/>
|
||||||
<property name="port" value="${mail.smtp.port}"/>
|
<property name="port" value="${mail.smtp.port}"/>
|
||||||
|
Loading…
Reference in New Issue
Block a user