Skip to content

Commit

Permalink
Start work on documents manipulation
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 25, 2015
1 parent 6be258a commit cc39835
Show file tree
Hide file tree
Showing 10 changed files with 169 additions and 189 deletions.
6 changes: 6 additions & 0 deletions .idea/resourceBundles.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ public void editor(@RequestParam String oper,NomenclatureTypes nomenclatureType,
@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,"name");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -121,14 +121,20 @@ public void editor(@RequestParam String oper,Nomenclature nomenclature,BindingRe

@Transactional(readOnly = false)
@RequestMapping(value = "/edittamplate", method = {RequestMethod.POST,RequestMethod.GET})
public void editorTemplate(@RequestParam String oper,@RequestParam long nmid,@RequestParam(required = false) Long nomenclature_id,@RequestParam(required = false) Long version,@RequestParam(required = false) Long count,@RequestParam(required = false) Long id,HttpServletResponse response)throws IOException {
public void editorTemplate(@RequestParam String oper,@RequestParam long nmid,@RequestParam(required = false) Long nomenclature_id,@RequestParam(required = false) Long nomenclaturetype_id,@RequestParam(required = false) Long version,@RequestParam(required = false) Long count,@RequestParam(required = false) Long id,HttpServletResponse response)throws IOException {
Nomenclature nomenclature=nomenclatureRepository.findOne(nmid);
if(nomenclature==null){
response.sendError(404, "NOMENCLATURE WITH ID " + nmid + " NOT FOUND!");
return;
}
switch (oper) {
case "add": {
Nomenclature nomenclature_for_constract = nomenclature_id != null ? nomenclatureRepository.findOne(nomenclature_id) : null;
NomenclatureTypes nomenclaturetype_for_constract = nomenclaturetype_id != null ? nomenclatureTypeRepository.findOne(nomenclaturetype_id) : null;
CombinedTemplate combined = new CombinedTemplate();
combined.setCount(count == null ? 0 : count);
combined.setNomenclature(nomenclature_for_constract);
combined.setNomenclatureType(nomenclaturetype_for_constract);
combined.setParent(nomenclature);
combinedTemplatesRepository.save(combined);
nomenclatureRepository.save(nomenclature);
Expand All @@ -138,10 +144,12 @@ public void editorTemplate(@RequestParam String oper,@RequestParam long nmid,@Re
case "edit": {
CombinedTemplate combined = combinedTemplatesRepository.findOne(id);
Nomenclature nomenclature_for_constract = nomenclature_id != null ? nomenclatureRepository.findOne(nomenclature_id) : null;
NomenclatureTypes nomenclaturetype_for_constract = nomenclaturetype_id != null ? nomenclatureTypeRepository.findOne(nomenclaturetype_id) : null;
if (combined != null) {
if (combined.getVersion() <= version) {
combined.setCount(count == null ? 0 : count);
combined.setNomenclature(nomenclature_for_constract);
combined.setNomenclatureType(nomenclaturetype_for_constract);
combinedTemplatesRepository.save(combined);
response.setStatus(200);
} else {
Expand Down Expand Up @@ -289,4 +297,42 @@ public JGridRowsResponse<NomenclatureTypes> getTypes(HttpServletRequest request,
return new JGridRowsResponse<>(nomenclatureTypeRepository.find(nm));
}
}

@Transactional(readOnly = false)
@RequestMapping(value = "/edittype", method = {RequestMethod.POST,RequestMethod.GET})
public void editorType(@RequestParam String oper,@RequestParam long nmid,@RequestParam Long type_id,HttpServletResponse response)throws IOException {
Nomenclature nomenclature=nomenclatureRepository.findOne(nmid);
if(nomenclature==null){
response.sendError(404, "NOMENCLATURE WITH ID " + nmid + " NOT FOUND!");
return;
}
switch (oper) {
case "add": {
NomenclatureTypes nomenclatureType = nomenclatureTypeRepository.findOne(type_id);
if(nomenclatureType!=null) {
nomenclature.addTypes(nomenclatureType);
nomenclatureRepository.save(nomenclature);
response.setStatus(200);
}else{
response.sendError(404, "NOMENCLATURE TYPE WITH ID " + type_id + " NOT FOUND!");
return;
}
}
break;
case "del": {
NomenclatureTypes nomenclatureType = nomenclatureTypeRepository.findOne(type_id);
if(nomenclatureType!=null) {
nomenclature.removeTypes(nomenclatureType);
nomenclatureRepository.save(nomenclature);
response.setStatus(200);
}else{
response.sendError(404, "NOMENCLATURE TYPE WITH ID " + type_id + " NOT FOUND!");
return;
}
}
break;
default:
response.sendError(406, "UNKNOWN OPERATION");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@ public class NomenclatureTypes {
@GeneratedValue
Long id;
String name;
String description;
@Version
long version=0;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,14 +20,14 @@ public interface NomenclatureTypeRepository extends JpaRepository<NomenclatureTy
List<NomenclatureTypes> findByNameContains(String name);
List<NomenclatureTypes> findByNameContains(String name, Sort sort);

@Query("select ct from NomenclatureTypes ct where :nomenclature in ct.nomenclature and ct.name like %:search%")
@Query("select ct from NomenclatureTypes ct where :nomenclature member ct.nomenclature and ct.name like %:search%")
Page<NomenclatureTypes> find(@Param(value = "search") String name,@Param(value = "nomenclature")Nomenclature nm, Pageable pager);
@Query("select ct from NomenclatureTypes ct where :nomenclature in ct.nomenclature")
@Query("select ct from NomenclatureTypes ct where :nomenclature member ct.nomenclature")
Page<NomenclatureTypes> find(@Param(value = "nomenclature")Nomenclature nm, Pageable pager);
@Query("select ct from NomenclatureTypes ct where :nomenclature in ct.nomenclature and ct.name like %:search%")
@Query("select ct from NomenclatureTypes ct where :nomenclature member ct.nomenclature and ct.name like %:search%")
List<NomenclatureTypes> find(@Param(value = "search") String name,@Param(value = "nomenclature")Nomenclature nm);
@Query("select ct from NomenclatureTypes ct where :nomenclature in ct.nomenclature")
@Query("select ct from NomenclatureTypes ct where :nomenclature member ct.nomenclature")
List<NomenclatureTypes> find(@Param(value = "nomenclature")Nomenclature nm);
@Query("select ct from NomenclatureTypes ct where :nomenclature in ct.nomenclature and ct.name like %:search%")
@Query("select ct from NomenclatureTypes ct where :nomenclature member ct.nomenclature and ct.name like %:search%")
List<NomenclatureTypes> find(@Param(value = "search") String name,@Param(value = "nomenclature")Nomenclature nm, Sort sort);
}
39 changes: 33 additions & 6 deletions src/main/resources/label_en_US.properties
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
label.messages={serverCommunicationError: 'An error occured while communicating to the server.',loadingMessage: 'Loading records...',noDataAvailable: 'No data available!',addNewRecord: 'Add new record',editRecord: 'Edit Record',areYouSure: 'Are you sure?',deleteConfirmation: 'This record will be deleted. Are you sure?',save: 'Save',saving: 'Saving',cancel: 'Cancel',deleteText: 'Delete',deleting: 'Deleting',error: 'Error',close: 'Close',cannotLoadOptionsFor: 'Can not load options for field {0}',pagingInfo: 'Showing {0}-{1} of {2}',pageSizeChangeLabel: 'Row count',gotoPageLabel: 'Go to page',canNotDeletedRecords: 'Can not deleted {0} of {1} records!',deleteProggress: 'Deleted {0} of {1} records, processing...'}
label.messages={serverCommunicationError\: 'An error occured while communicating to the server.',loadingMessage\: 'Loading records...',noDataAvailable\: 'No data available\!',addNewRecord\: 'Add new record',editRecord\: 'Edit Record',areYouSure\: 'Are you sure?',deleteConfirmation\: 'This record will be deleted. Are you sure?',save\: 'Save',saving\: 'Saving',cancel\: 'Cancel',deleteText\: 'Delete',deleting\: 'Deleting',error\: 'Error',close\: 'Close',cannotLoadOptionsFor\: 'Can not load options for field {0}',pagingInfo\: 'Showing {0}-{1} of {2}',pageSizeChangeLabel\: 'Row count',gotoPageLabel\: 'Go to page',canNotDeletedRecords\: 'Can not deleted {0} of {1} records\!',deleteProggress\: 'Deleted {0} of {1} records, processing...'}
label.loginform=Please Sign In
label.login = Enter on site
label.loginincorect = Login incorrect!
label.loginincorect = Login incorrect\!
label.loginname = Login
label.loginpass = Password
label.usertables = Table of System Users
Expand Down Expand Up @@ -94,7 +94,7 @@ label.norelation = No family house relations
label.trunsaction = Data changed by another user
label.nouser = No user with ID {}
label.norole = No role with ID {}
label.norecord = No records found!
label.norecord = No records found\!
label.addcomplaint = burn them directly complaints
label.addcomplaint.title = new complaint
label.lang = en
Expand Down Expand Up @@ -124,9 +124,9 @@ label.statistic.area2.label4 = Created new categories
label.statistic.area2.label5 = Created new types inforatsii
label = internal customer database (version 0.5 Beta)
label.button.print=Print
label.dashboard.creteria=Show last added dossers :
label.dashboard.creteria=Show last added dossers \:
label.s403.title = Access Forbidden
label.s403.message = entered your username and password will not be tolerated!
label.s403.message = entered your username and password will not be tolerated\!
label.s403.link = Repeat
label.s404.title = The requested page is not
label.s404.message = The page you requested was not found
Expand Down Expand Up @@ -155,4 +155,31 @@ label.documents.files.filename=File Name
label.documents.files.fileType=File Type
label.documents.files.fileSize=File Size
label.documents.files.creationDate=Creation Date
label.documents.files.file=File
label.documents.files.file=File
label.nomenclaure=Nomenclature
label.nomenclature.title=Nomenclatures
label.nomenclature.code=CODE
label.nomenclature.name=NAME
label.nomenclature.manufacturer=Manufacturer
label.nomenclature.country=Country
label.nomenclature.description=Description
label.nomenclature.template.name=Template Name
label.nomenclature.template.type=Template type
label.nomenclature.template.count=Count
label.nomenclature.types=Nomenclature Types
label.nomenclature.templates=Nomenclature Templates
label.button.refresh=R
label.sql.table.label=Refresh
label.button.allrecord=
label.edit.persons.passportInfo=
label.direcotry=Directory
label.persons=
label.persons.person=
label.clientstables=
label.field.name=
label.persons.person.title=
label.edit.persons.info_title=
label.field.name2=
label.button.loadrecord=
label.edit.persons.contactstable.contact_info.col_title=
label.edit.persons.title=
Loading

0 comments on commit cc39835

Please sign in to comment.