Commit f81ad34f authored by Bas Lijnse's avatar Bas Lijnse

Standardized all string serialization/deserialization on JSON. GenPrint and...

Standardized all string serialization/deserialization on JSON. GenPrint and GenParse are no longer used. This was required for being able to offer and manipulate complete task values through the webservices.

git-svn-id: https://svn.cs.ru.nl/repos/iTask-system/trunk@1134 63da3aa8-80fd-4f01-9db8-e6ea747a3da2
parent 77abee7e
......@@ -10,12 +10,8 @@ import CommonDomain
// One by one the chosen bookings will be handled
// The bill is made up in the end
derive gParse PlaceToGo, FlightHotel
derive gPrint PlaceToGo, FlightHotel
derive gUpdate PlaceToGo, FlightHotel
derive gError PlaceToGo, FlightHotel
derive gHint PlaceToGo, FlightHotel
derive gVisualize PlaceToGo, FlightHotel
derive class iTask PlaceToGo, FlightHotel
derive bimap (,), Maybe
BookTrip :: Task FlightHotel
......
......@@ -62,13 +62,7 @@ allproviders = [{name="Ambulance Post 0",id=NamedUser "ambupost0",location={str
,{name="Ambulance Post 9",id=NamedUser "ambupost9",location={street="Teststreet",place="Testville",coordinates=Just{lat=9.0,lon=3.0}},capacity=2}
]
derive gPrint Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive gParse Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive gVisualize Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive gUpdate Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive gError Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive gHint Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive class iTask Incident, IncidentType, Location, Address, MapCoordinates, Provider, Opinion
derive bimap (,), Maybe
derive gEq IncidentType
......
......@@ -7,13 +7,7 @@ import google_maps_services
import Base64
import DocumentDomain
derive gPrint Incident, IncidentType
derive gParse Incident, IncidentType
derive gVisualize Incident, IncidentType
derive gUpdate Incident, IncidentType
derive gError Incident, IncidentType
derive gHint Incident, IncidentType
derive class iTask Incident, IncidentType
derive bimap (,), Maybe
ambulanceDispatchMapExamples :: [Workflow]
......
definition module FlowData
import iTasks
derive gPrint Flow, FlowShape, AssignInfo, CleanExpr
derive gParse Flow, FlowShape, AssignInfo, CleanExpr
derive gUpdate Flow, FlowShape, AssignInfo, CleanExpr
derive gVisualize Flow, FlowShape, AssignInfo, CleanExpr
derive gError Flow, FlowShape, AssignInfo, CleanExpr
derive gHint Flow, FlowShape, AssignInfo, CleanExpr
derive class iTask Flow, FlowShape, AssignInfo, CleanExpr
:: Flow = { flowShape :: ![FlowShape]
, flowDyn :: !Dynamic
......
......@@ -5,15 +5,7 @@ from FormFlowStorage import findValue, findFlow
// import get_dictionary
derive gPrint Flow, FlowShape, AssignInfo, CleanExpr
derive gParse Flow, FlowShape, AssignInfo, CleanExpr
derive gUpdate Flow, FlowShape, AssignInfo, CleanExpr
derive gVisualize Flow, FlowShape, AssignInfo, CleanExpr
derive gError Flow, FlowShape, AssignInfo, CleanExpr
derive gHint Flow, FlowShape, AssignInfo, CleanExpr
derive class iTask Flow, FlowShape, AssignInfo, CleanExpr
derive bimap Maybe, (,)
:: Flow = { flowShape :: ![FlowShape]
......
definition module FormData
import iTasks
derive gPrint Form, FormShape
derive gParse Form, FormShape
derive gUpdate Form, FormShape
derive gVisualize Form, FormShape
derive gError Form, FormShape
derive gHint Form, FormShape
derive class iTask Form, FormShape
:: Form = { formShape :: ![FormShape]
, formDyn :: !Dynamic
......
......@@ -4,13 +4,7 @@ import iTasks, TaskContainer, GeoDomain
from StdFunc import o
from StdMisc import abort
derive gPrint Form, FormShape, Tup
derive gParse Form, FormShape, Tup
derive gUpdate Form, FormShape, Tup
derive gVisualize Form, FormShape, Tup
derive gError Form, FormShape, Tup
derive gHint Form, FormShape, Tup
derive class iTask Form, FormShape, Tup
derive bimap Maybe, (,)
:: Form = { formShape :: ![FormShape]
......
......@@ -16,14 +16,9 @@ formEditor = workflow "Examples/Interactive Workflows/Form Editor" handleMenu
emptyState = (("",emptyForm),NoEdit)
setShape ((name,form),mode) shape = ((name,{form & formShape = shape}),mode)
derive gEq Mode
derive gPrint Mode
derive gParse Mode
derive gUpdate Mode
derive gVisualize Mode
derive gError Mode
derive gHint Mode
derive bimap Maybe, (,)
derive class iTask Mode
derive gEq Mode
derive bimap Maybe, (,)
ActionEditType :== ActionLabel "Edit Type"
ActionEditValue :== ActionLabel "Edit Value"
......
......@@ -3,13 +3,8 @@ definition module FormFlowStorage
import iTasks
import FormData, FlowData
derive gPrint FormStore, FlowStore
derive gParse FormStore, FlowStore
derive gUpdate FormStore, FlowStore
derive gVisualize FormStore, FlowStore
derive gError FormStore, FlowStore
derive gHint FormStore, FlowStore
derive class iTask FormStore, FlowStore
:: FormStore = { formName :: !String
, formType :: !String
......
......@@ -5,14 +5,8 @@ from StdFunc import o
from EstherBackend import toStringDynamic
import FormData, FlowData, TaskContainer
derive gPrint FormStore, FlowStore
derive gParse FormStore, FlowStore
derive gUpdate FormStore, FlowStore
derive gVisualize FormStore, FlowStore
derive gError FormStore, FlowStore
derive gHint FormStore, FlowStore
derive class iTask FormStore, FlowStore
derive bimap Maybe, (,)
:: FormStore = { formName :: !String
......
......@@ -3,13 +3,7 @@ implementation module MovingTask
import iTasks
import CommonDomain
derive gVisualize QForm, Person, Gender
derive gUpdate QForm, Person, Gender
derive gParse QForm, Person, Gender
derive gPrint QForm, Person, Gender
derive gError QForm, Person, Gender
derive gHint QForm, Person, Gender
derive class iTask QForm, Person, Gender
derive bimap (,), Maybe
:: QForm = { forCompany :: String
......
......@@ -12,13 +12,7 @@ import CommonDomain
// Otherwise the task is completed
// The task itself in the example is a quotation form that needs to be filled in
derive gPrint QForm, Review, Person, Gender
derive gParse QForm, Review, Person, Gender
derive gVisualize QForm, Review, Person, Gender
derive gUpdate QForm, Review, Person, Gender
derive gError QForm, Review, Person, Gender
derive gHint QForm, Review, Person, Gender
derive class iTask QForm, Review, Person, Gender
derive bimap (,), Maybe
:: PersonData = { name :: String
......
......@@ -35,13 +35,7 @@ import CommonDomain
:: BugNr :== Int
derive gPrint BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive gParse BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive gVisualize BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive gUpdate BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive gError BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive gHint BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive class iTask BugReport, Bug, BugSeverity, BugOccurance, BugStatus, BugAnalysis
derive bimap (,), Maybe
instance DB Bug where
......
......@@ -7,13 +7,7 @@ import iTasks
:: NegativeValueException = NegativeValueException String
:: TooLargeValueException = TooLargeValueException String
derive gVisualize NegativeValueException, TooLargeValueException
derive gUpdate NegativeValueException, TooLargeValueException
derive gPrint NegativeValueException, TooLargeValueException
derive gParse NegativeValueException, TooLargeValueException
derive gError NegativeValueException, TooLargeValueException
derive gHint NegativeValueException, TooLargeValueException
derive class iTask NegativeValueException, TooLargeValueException
derive bimap (,), Maybe
exceptionHandlingExample :: [Workflow]
......
......@@ -25,13 +25,7 @@ guiDemoExample
, note :: Maybe Note
}
derive gPrint Person, Address
derive gParse Person, Address
derive gVisualize Person, Address
derive gUpdate Person, Address
derive gHint Person, Address
derive gError Person, Address
derive class iTask Person, Address
derive bimap (,), Maybe
address = {Address | street = "Heyendaalseweg", number = 135, postalCode = "6525 AJ", city = "Nijmegen"}
......
......@@ -10,13 +10,7 @@ import iTasks
import Text
import CommonDomain
derive gPrint EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive gParse EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive gVisualize EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive gUpdate EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive gError EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive gHint EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive class iTask EMail, Reply, DisplayNews, Broadcast, ReplyHdr
derive bimap Maybe, (,)
newsgroupsExample :: [Workflow]
......@@ -31,12 +25,7 @@ newsgroupsExample
, workflow "Examples/Communication/Chat with someone" chat
]
derive gPrint InstructionMsg
derive gParse InstructionMsg
derive gVisualize InstructionMsg
derive gUpdate InstructionMsg
derive gError InstructionMsg
derive gHint InstructionMsg
derive class iTask InstructionMsg
:: InstructionMsg = { worker :: !User
, title :: !String
......@@ -56,14 +45,8 @@ mkInstruction
// --- Appointment Example ---
// date fixing
derive gPrint Appointment, Meeting, Attending
derive gParse Appointment, Meeting, Attending
derive gVisualize Appointment, Meeting, Attending
derive gUpdate Appointment, Meeting, Attending
derive gError Appointment, Meeting, Attending
derive gHint Appointment, Meeting, Attending
derive gMerge Meeting, Appointment, Attending
derive class iTask Appointment, Meeting, Attending
derive gMerge Appointment, Meeting, Attending
:: Appointment = { topic :: Note
}
......@@ -115,13 +98,8 @@ where
defineOptions = enterInformation "Define date and time options:"
// ====== CHAT =====================================================
derive gPrint Chat, ChatMessage, ChatView, ChatMessageView
derive gParse Chat, ChatMessage, ChatView, ChatMessageView
derive gUpdate Chat, ChatMessage, ChatView, ChatMessageView
derive gVisualize Chat, ChatMessage, ChatView, ChatMessageView
derive gMerge Chat, ChatMessage, ChatView, ChatMessageView
derive gError Chat, ChatMessage, ChatView, ChatMessageView
derive gHint Chat, ChatMessage, ChatView, ChatMessageView
derive class iTask Chat, ChatMessage, ChatView, ChatMessageView
derive gMerge Chat, ChatMessage, ChatView, ChatMessageView
//Shared State
:: Chat =
......
......@@ -5,7 +5,7 @@ from Types import :: Role
from Html import :: HtmlTag
from iTasks import class iTask(..)
from ProcessDB import :: Action
import GenPrint, GenParse, GenVisualize, GenUpdate, GenMerge, StoreTasks
import GenVisualize, GenUpdate, GenMerge, StoreTasks
// This type class contains types that may be used as
// messages and questions: plain strings and html.
......
......@@ -503,7 +503,7 @@ where
Just v = (v,tst)
Nothing = abort "cannot get local value"
readShared :: !String !*TSt -> *((Maybe a),*TSt) | gParse{|*|}, TC a
readShared :: !String !*TSt -> *((Maybe a),*TSt) | JSONDecode{|*|}, TC a
readShared sid tst=:{TSt|iworld = iworld =:{IWorld|store,world}}
# (mbvalue,store,world) = loadValue sid store world
# tst = {TSt|tst & iworld = {IWorld| iworld & store = store, world = world}}
......@@ -549,8 +549,8 @@ where
ActionLabel text = text
ActionIcon text _ = text
ActionParam text _ = text
action #str = printToString action
| startsWith "Action" str = subString 6 ((textSize str)-1) str
action #str = (toString (toJSON action))
| startsWith "\"Action" str = subString 7 ((textSize str)-8) str
| otherwise = str
//Generate a set of action buttons by joining the buttons that are always shown and those only active when valid
......@@ -570,9 +570,9 @@ getAction events buttonActions tst
| index <> -1
= (Just (buttonActions !! index),tst)
| otherwise
= case parseString (http_getValue "menu" events "") of
Nothing = case parseString (http_getValue "menuAndGroup" events "") of
Nothing = (parseString (http_getValue "hotkey" events "") ,tst)
= case fromJSON (fromString (http_getValue "menu" events "")) of
Nothing = case fromJSON (fromString (http_getValue "menuAndGroup" events "")) of
Nothing = (fromJSON (fromString (http_getValue "hotkey" events "")) ,tst)
res = (res, tst)
res = (res ,tst)
......
......@@ -3,7 +3,7 @@ definition module MenuTasks
from ProcessDB import ::Menu, ::MenuItem, ::Hotkey{..}, ::Key(..)
from TSt import ::Task
from Void import :: Void
import StdMaybe, GenPrint, GenParse, GenVisualize, GenUpdate
import StdMaybe, GenVisualize, GenUpdate
derive class iTask Menu, MenuItem, Hotkey
......
......@@ -11,9 +11,9 @@ from TaskTree import :: TaskParallelType
from Time import :: Timestamp
from iTasks import class iTask
import GenVisualize, GenUpdate, GenParse, GenPrint
import GenVisualize, GenUpdate
derive class iTask ProcessRef, Process, TaskProperties, SystemProperties, ManagerProperties, WorkerProperties, TaskStatus, TaskPriority, TaskProgress, Timestamp, TaskParallelType
derive class iTask ProcessRef, Process, TaskProperties, SystemProperties, ManagerProperties, WorkerProperties, TaskStatus, TaskPriority, TaskProgress, TaskParallelType
//Allow either typed or untyped references to lookup a process table entry
class toProcessId a where toProcessId :: a -> ProcessId
......
......@@ -18,7 +18,7 @@ import CommonCombinators
import Store
derive class iTask ProcessRef, Process, TaskProperties, SystemProperties, ManagerProperties, WorkerProperties, TaskStatus, TaskPriority, TaskProgress, Timestamp, TaskParallelType
derive class iTask ProcessRef, Process, TaskProperties, SystemProperties, ManagerProperties, WorkerProperties, TaskStatus, TaskPriority, TaskProgress, TaskParallelType
derive bimap Maybe, (,)
......
......@@ -4,7 +4,7 @@ from TSt import :: Task
from Types import :: SessionId, :: Session, :: User
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
/**
* Create a new session
......
......@@ -11,7 +11,7 @@ from TSt import mkInstantTask, mkTaskFunction
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
createSession :: !User -> Task Session
createSession user = mkInstantTask "createSession" (mkTaskFunction ('SessionDB'.createSession user))
......
......@@ -6,7 +6,7 @@ from TSt import :: Task
from StdOverloaded import class ==, class <
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate, GenMerge
import GenVisualize, GenUpdate, GenMerge
//Database identifier for storing a single value of type a
::DBid a :== String
......@@ -16,11 +16,12 @@ import GenPrint, GenParse, GenVisualize, GenUpdate, GenMerge
derive gVisualize DBRef
derive gUpdate DBRef
derive gPrint DBRef
derive gParse DBRef
derive gMerge DBRef
derive gHint DBRef
derive gError DBRef
derive gMerge DBRef
derive JSONEncode DBRef
derive JSONDecode DBRef
//Core database access functions
......
......@@ -6,15 +6,16 @@ from StdFunc import id, const
from SystemTasks import getDefaultValue
import CoreCombinators
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
derive gVisualize DBRef
derive gUpdate DBRef
derive gPrint DBRef
derive gParse DBRef
derive gMerge DBRef
derive gHint DBRef
derive gError DBRef
derive gMerge DBRef
derive JSONEncode DBRef
derive JSONDecode DBRef
derive bimap Maybe, (,)
......
......@@ -6,7 +6,7 @@ from TSt import :: Task
from Types import :: User, :: ProcessId, :: ProcessRef
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
/**
* Returns the user currently logged in the iTask system
......
......@@ -18,7 +18,7 @@ from UserDB import qualified instance UserDB TSt
from ProcessDB import :: Menu
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
getCurrentUser :: Task User
getCurrentUser = mkInstantTask "getCurrentUser" getCurrentUser`
......
......@@ -15,13 +15,14 @@ from Types import :: User (..)
:: GAction = GStop | GContinue | GExtend [Task GAction] | GFocus String
:: GOnlyAction = GOStop | GOContinue | GOExtend [Task Void] | GOFocus String
derive gParse GAction, GOnlyAction
derive gPrint GAction, GOnlyAction
derive gVisualize GAction, GOnlyAction
derive gUpdate GAction, GOnlyAction
derive gError GAction, GOnlyAction
derive gHint GAction, GOnlyAction
derive JSONEncode GAction, GOnlyAction
derive JSONDecode GAction, GOnlyAction
/**
* Tasks can dynamically add other tasks or stop execution of group.
*
......
......@@ -19,12 +19,14 @@ import SystemTasks, InteractionTasks, UserDBTasks, CoreCombinators, TuningCombin
import Util, Either
import GenVisualize, GenUpdate
derive gParse GAction, GOnlyAction, GroupedBehaviour, Either
derive gPrint GAction, GOnlyAction, GroupedBehaviour, Either
derive gVisualize GAction, GOnlyAction, GroupedBehaviour
derive gUpdate GAction, GOnlyAction, GroupedBehaviour
derive gError GAction, GOnlyAction, GroupedBehaviour
derive gHint GAction, GOnlyAction, GroupedBehaviour
derive JSONEncode GAction, GOnlyAction, GroupedBehaviour
derive JSONDecode GAction, GOnlyAction, GroupedBehaviour
derive bimap Maybe, (,)
//Grouping combinators
......
......@@ -10,7 +10,7 @@ from ProcessDB import :: Action
from TuningCombinators import :: Tag
from iTasks import class iTask(..)
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
//Standard monadic operations:
......
......@@ -105,12 +105,12 @@ where
TaskException e = (TaskException e,tst)
// Parallel / Grouped composition
derive gPrint PSt
derive gParse PSt
derive gVisualize PSt
derive gUpdate PSt
derive gError PSt
derive gHint PSt
derive JSONEncode PSt
derive JSONDecode PSt
derive bimap Maybe, (,)
......@@ -125,7 +125,7 @@ where
execInGroup tst=:{taskNr,request}
# grTaskNr = drop 1 taskNr // get taskNr of group-task
# (events,tst) = getGroupEvents (taskNrToString grTaskNr) tst
# eventActions = [parseString value \\ (_, value) <- events]
# eventActions = [fromJSON (fromString value) \\ (_, value) <- events]
# (pst,tst) = loadPSt grTaskNr tst
# (gActionStop,mbFocus,pst)
= case eventActions of
......
......@@ -6,7 +6,7 @@ definition module ExceptionCombinators
from TSt import :: Task
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
/**
* Exception combinator.
......
......@@ -4,7 +4,7 @@ definition module LiftingCombinators
*/
from TSt import :: Task, :: TSt
from iTasks import class iTask
import GenPrint, GenParse, GenVisualize, GenUpdate
import GenVisualize, GenUpdate
/**
* Evaluate a "World" function that does not yield any result once.
......
......@@ -3,7 +3,7 @@ definition module CommonDomain
* This module provides a series of data types, their iTask generics obligations and utility
* functions for common data in workflows.
*/
import GenPrint, GenParse, GenVisualize, GenUpdate, GenMerge
import GenVisualize, GenUpdate, GenMerge
import StdString
from Html import :: HtmlTag
......@@ -51,14 +51,17 @@ currentDateTime :: !*World -> (!DateTime,!*World)
| USD Int
| JPY Int
derive gPrint EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gParse EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gVisualize EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gUpdate EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gMerge EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gError EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive gHint EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive JSONEncode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
derive JSONDecode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton
instance html Note
instance == Note
......
......@@ -2,11 +2,9 @@ implementation module CommonDomain
import iTasks
import StdOverloaded, StdClass, StdInt, StdMisc, StdArray
import GenPrint, GenParse, GenVisualize, GenUpdate, GenLexOrd
import GenVisualize, GenUpdate, GenLexOrd
import Text, Time
derive gPrint EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
derive gParse EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
derive gVisualize EmailAddress, DateTime
derive gUpdate EmailAddress, Note, DateTime
derive gMerge EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
......@@ -14,6 +12,9 @@ derive gLexOrd Currency
derive gHint EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
derive gError EmailAddress, DateTime
derive JSONEncode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
derive JSONDecode EmailAddress, Password, Note, Date, Time, DateTime, Currency, FormButton, ButtonState
derive bimap Maybe, (,)
//VValue a DataMask
......