Skip to content

Commit

Permalink
SET USER SERVICE TO DB
Browse files Browse the repository at this point in the history
TODO:
DOCUMENT MANIPULATION
DOCUMENT FILE MANIPULATION
TASK MANIPULATION
SHOW CONTEOLLED TASK FOR USER
SHOW USERS TASK
STOREHAUSE MANIPULATION
GOOD PRODUCTION AND SERVICE
  • Loading branch information
FairWindCo committed Oct 16, 2015
1 parent 2b4801c commit a0459eb
Show file tree
Hide file tree
Showing 6 changed files with 372 additions and 52 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -134,7 +134,7 @@ public void editor(@RequestParam String oper,ContactType contactType,BindingResu
public Object simpleClientList(@RequestParam(required = false) Integer page_num, @RequestParam(required = false) Integer per_page,@RequestParam(value = "pkey_val[]",required = false) String pkey,@RequestParam(value = "q_word[]",required = false) String[] qword,@RequestParam long firmID) {
// Retrieve all persons by delegating the call to PersonService
//Sort sort= FormSort.formSortFromSortDescription(orderby);
Sort sort=new Sort(Sort.Direction.ASC,"surname");
Sort sort=new Sort(Sort.Direction.ASC,"name");
PageRequest pager=null;
if(page_num!=null && per_page!=null) {
pager = new PageRequest(page_num - 1, per_page, sort);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
import org.springframework.data.domain.PageRequest;
import org.springframework.data.domain.Sort;
import org.springframework.security.access.annotation.Secured;
import org.springframework.security.core.context.SecurityContext;
import org.springframework.security.core.context.SecurityContextHolder;
import org.springframework.stereotype.Controller;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.ui.Model;
Expand Down Expand Up @@ -34,8 +34,8 @@
public class DocumentController {
@Autowired
DocumentRepository documentRepository;
@Autowired
SecurityContext securityContext;



@Secured("ROLE_USER")
@RequestMapping(value = "/list", method = RequestMethod.GET)
Expand Down Expand Up @@ -86,7 +86,7 @@ public void editor(@RequestParam String oper,Document document,BindingResult res
response.sendError(400,result.toString());
return;
}
UserDetailsAdapter userDetail=(UserDetailsAdapter)securityContext.getAuthentication().getDetails();
UserDetailsAdapter userDetail=(UserDetailsAdapter)SecurityContextHolder.getContext().getAuthentication().getDetails();
if(userDetail==null){
response.sendError(403, "FORBIDDEN!");
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -124,10 +124,10 @@ public void editor(@RequestParam String oper,DocumentType documentType,BindingRe
@Transactional(readOnly = true)
@RequestMapping(value = "/showList", method = RequestMethod.GET)
@ResponseBody
public Object simpleClientList(@RequestParam(required = false) Integer page_num, @RequestParam(required = false) Integer per_page,@RequestParam(value = "pkey_val[]",required = false) String pkey,@RequestParam(value = "q_word[]",required = false) String[] qword,@RequestParam long firmID) {
public Object simpleClientList(@RequestParam(required = false) Integer page_num, @RequestParam(required = false) Integer per_page,@RequestParam(value = "pkey_val[]",required = false) String pkey,@RequestParam(value = "q_word[]",required = false) String[] qword) {
// Retrieve all persons by delegating the call to PersonService
//Sort sort= FormSort.formSortFromSortDescription(orderby);
Sort sort=new Sort(Sort.Direction.ASC,"surname");
Sort sort=new Sort(Sort.Direction.ASC,"name");
PageRequest pager=null;
if(page_num!=null && per_page!=null) {
pager = new PageRequest(page_num - 1, per_page, sort);
Expand Down
3 changes: 3 additions & 0 deletions src/main/webapp/jsp/counterparts_list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -193,12 +193,15 @@
button_img:'${pageContext.request.contextPath}/resources/images/btn.png',
init_record: [value_elem],
sub_info: true,
bind_to:'personIDkey_setup',
/**/
sub_as: {
surname: 'surname',
middleName: 'middleName',
firstName:'firstName'
}/**/
}).bind('personIDkey_setup', function() {
$('#headID_primary_key').val($('#head.id_primary_key').val());
});
}/**/
}},
Expand Down
30 changes: 29 additions & 1 deletion src/main/webapp/jsp/documents_list.jsp
Original file line number Diff line number Diff line change
Expand Up @@ -60,12 +60,40 @@
datatype: 'json',
mtype: 'POST',
styleUI : 'Bootstrap',
colNames:['<c:message code="label.id"/>', '<c:message code="label.counterparts.table.col_title.name"/>', '<c:message code="label.counterparts.table.col_title.fullname"/>','<c:message code="label.version"/>'],
colNames:['<c:message code="label.id"/>', '<c:message code="label.documents.table.col_title.number"/>', '<c:message code="label.documents.table.col_title.name"/>', '<c:message code="label.documents.table.col_title.description"/>','<c:message code="label.documents.table.col_title.document_type"/>','<c:message code="label.documents.table.col_title.document_type"/>','<c:message code="label.version"/>'],
colModel:[
{name:'id',index:'id', width:55, editable:false, editoptions:{readonly:true, size:10}, hidden:true},
{name:'number',index:'number', width:100, editable:true, editrules:{required:true}, editoptions:{size:10}},
{name:'name',index:'name', width:100, editable:true, editrules:{required:false}, editoptions:{size:10},search:false},
{name:'description',index:'description', width:100, editable:true, editrules:{required:false}, editoptions:{size:10},search:false},
{name:'documentType_key', width:100, editable:true,hidden:true, search:false},
{name:'documentType', width:100, editable:true, editrules:{required:false},search:false,editoptions:{
/**/
formater:function(elem){
return elem.name;
},
dataInit : function (elem) {
var value_elem=$(elem).val();
$(elem).wrap("<div></div>");
$(elem).width='80px';
$(elem).ajaxComboBox('${pageContext.request.contextPath}/documenttypes/showList',
{lang: 'en',
db_table: 'nation',
per_page: 20,
navi_num: 10,
select_only: true,
primary_key: 'id',
show_field: 'name',
field:'name',
//recalc_width:false,
button_img:'${pageContext.request.contextPath}/resources/images/btn.png',
init_record: [value_elem.id],
bind_to:'personIDkey_setup',
}).bind('personIDkey_setup', function() {
$('#documentType_key').val($('#documenttypeid_primary_key').val());
});
}/**/
}},
{name:'version',index:'version', width:100, editable:true, editrules:{readonly:true}, editoptions:{size:10,defaultValue:'0'}, hidden:true},
],
rowNum:10,
Expand Down
Loading

0 comments on commit a0459eb

Please sign in to comment.