Skip to content

Commit 5690ed3

Browse files
committed
update GetJobAttributes
1 parent 0045580 commit 5690ed3

File tree

4 files changed

+162
-185
lines changed

4 files changed

+162
-185
lines changed

SharpIpp/Mapping/Profiles/GetJobAttributesProfile.cs

+38-35
Original file line numberDiff line numberDiff line change
@@ -55,42 +55,39 @@ public void CreateMaps(IMapperConstructor mapper)
5555

5656
mapper.CreateMap<IDictionary<string, IppAttribute[]>, JobDescriptionAttributes>((src, map) => new JobDescriptionAttributes
5757
{
58-
Copies = map.MapFromDic<int?>(src, JobAttribute.Copies),
5958
DateTimeAtCompleted = map.MapFromDic<DateTimeOffset?>(src, JobAttribute.DateTimeAtCompleted),
6059
DateTimeAtCreation = map.MapFromDic<DateTimeOffset?>(src, JobAttribute.DateTimeAtCreation),
6160
DateTimeAtProcessing = map.MapFromDic<DateTimeOffset?>(src, JobAttribute.DateTimeAtProcessing),
62-
Finishings = map.MapFromDic<Finishings?>(src, JobAttribute.Finishings),
6361
JobId = map.MapFromDic<int?>(src, JobAttribute.JobId),
6462
JobUri = map.MapFromDic<string?>(src, JobAttribute.JobUri),
6563
JobImpressionsCompleted = map.MapFromDic<int?>(src, JobAttribute.JobImpressionsCompleted),
6664
JobMediaSheetsCompleted = map.MapFromDic<int?>(src, JobAttribute.JobMediaSheetsCompleted),
6765
JobOriginatingUserName = map.MapFromDic<string?>(src, JobAttribute.JobOriginatingUserName),
68-
JobOriginatingUserNameLanguage =
69-
map.MapFromDicLanguage(src, JobAttribute.JobOriginatingUserNameLanguage),
7066
JobPrinterUpTime = map.MapFromDic<int?>(src, JobAttribute.JobPrinterUpTime),
7167
JobPrinterUri = map.MapFromDic<string?>(src, JobAttribute.JobPrinterUri),
72-
JobSheets = map.MapFromDic<JobSheets?>(src, JobAttribute.JobSheets),
7368
JobState = map.MapFromDic<JobState?>(src, JobAttribute.JobState),
7469
JobStateMessage = map.MapFromDic<string?>(src, JobAttribute.JobStateMessage),
7570
JobStateReasons = map.MapFromDicSetNull<JobStateReason[]?>(src, JobAttribute.JobStateReasons),
76-
Media = map.MapFromDic<string?>(src, JobAttribute.Media),
77-
MultipleDocumentHandling =
78-
map.MapFromDic<MultipleDocumentHandling?>(src, JobAttribute.MultipleDocumentHandling),
79-
NumberUp = map.MapFromDic<int?>(src, JobAttribute.NumberUp),
80-
OrientationRequested = map.MapFromDic<Orientation?>(src, JobAttribute.OrientationRequested),
81-
PrinterResolution = map.MapFromDic<Resolution?>(src, JobAttribute.PrinterResolution),
82-
PrintQuality = map.MapFromDic<PrintQuality?>(src, JobAttribute.PrintQuality),
83-
Sides = map.MapFromDic<Sides?>(src, JobAttribute.Sides),
8471
TimeAtCompleted = map.MapFromDic<int?>(src, JobAttribute.TimeAtCompleted),
8572
TimeAtCreation = map.MapFromDic<int?>(src, JobAttribute.TimeAtCreation),
8673
TimeAtProcessing = map.MapFromDic<int?>(src, JobAttribute.TimeAtProcessing),
74+
JobName = map.MapFromDic<string?>(src, JobAttribute.JobName),
75+
JobKOctetsProcessed = map.MapFromDic<int?>(src, JobAttribute.JobKOctetsProcessed),
76+
JobImpressions = map.MapFromDic<int?>(src, JobAttribute.JobImpressions),
77+
JobMediaSheets = map.MapFromDic<int?>(src, JobAttribute.JobMediaSheets),
78+
JobMoreInfo = map.MapFromDic<string?>(src, JobAttribute.JobMoreInfo),
79+
NumberOfDocuments = map.MapFromDic<int?>(src, JobAttribute.NumberOfDocuments),
80+
NumberOfInterveningJobs = map.MapFromDic<int?>(src, JobAttribute.NumberOfInterveningJobs),
81+
OutputDeviceAssigned = map.MapFromDic<string?>(src, JobAttribute.OutputDeviceAssigned),
82+
JobKOctets = map.MapFromDic<int?>(src, JobAttribute.JobKOctets),
83+
JobDetailedStatusMessages = map.MapFromDicSetNull<string[]?>(src, JobAttribute.JobDetailedStatusMessages),
84+
JobDocumentAccessErrors = map.MapFromDicSetNull<string[]?>(src, JobAttribute.JobDocumentAccessErrors),
85+
JobMessageFromOperator = map.MapFromDic<string?>(src, JobAttribute.JobMessageFromOperator)
8786
});
8887

8988
mapper.CreateMap<JobDescriptionAttributes, IDictionary<string, IppAttribute[]>>( ( src, map ) =>
9089
{
9190
var dic = new Dictionary<string, IppAttribute[]>();
92-
if ( src.Copies != null )
93-
dic.Add( JobAttribute.Copies, new IppAttribute[] { new IppAttribute( Tag.Integer, JobAttribute.Copies, src.Copies.Value ) } );
9491
if (src.DateTimeAtCompleted != null)
9592
{
9693
if (src.DateTimeAtCompleted.Value > DateTimeOffset.MinValue)
@@ -112,8 +109,6 @@ public void CreateMaps(IMapperConstructor mapper)
112109
else
113110
dic.Add(JobAttribute.DateTimeAtProcessing, new IppAttribute[] { new IppAttribute(Tag.NoValue, JobAttribute.DateTimeAtProcessing, NoValue.Instance) });
114111
}
115-
if ( src.Finishings != null )
116-
dic.Add( JobAttribute.Finishings, new IppAttribute[] { new IppAttribute( Tag.Enum, JobAttribute.Finishings, (int)src.Finishings.Value ) } );
117112
if ( src.JobId != null )
118113
dic.Add( JobAttribute.JobId, new IppAttribute[] { new IppAttribute( Tag.Integer, JobAttribute.JobId, src.JobId.Value ) } );
119114
if( src.JobUri != null )
@@ -124,34 +119,16 @@ public void CreateMaps(IMapperConstructor mapper)
124119
dic.Add( JobAttribute.JobMediaSheetsCompleted, new IppAttribute[] { new IppAttribute( Tag.Integer, JobAttribute.JobMediaSheetsCompleted, src.JobMediaSheetsCompleted.Value ) } );
125120
if ( src.JobOriginatingUserName != null )
126121
dic.Add( JobAttribute.JobOriginatingUserName, new IppAttribute[] { new IppAttribute( Tag.NameWithoutLanguage, JobAttribute.JobOriginatingUserName, src.JobOriginatingUserName ) } );
127-
if ( src.JobOriginatingUserNameLanguage != null )
128-
dic.Add( JobAttribute.JobOriginatingUserNameLanguage, new IppAttribute[] { new IppAttribute( Tag.NaturalLanguage, JobAttribute.JobOriginatingUserNameLanguage, src.JobOriginatingUserNameLanguage ) } );
129122
if ( src.JobPrinterUpTime != null )
130123
dic.Add( JobAttribute.JobPrinterUpTime, new IppAttribute[] { new IppAttribute( Tag.Integer, JobAttribute.JobPrinterUpTime, src.JobPrinterUpTime.Value ) } );
131124
if ( src.JobPrinterUri != null )
132125
dic.Add( JobAttribute.JobPrinterUri, new IppAttribute[] { new IppAttribute( Tag.Uri, JobAttribute.JobPrinterUri, src.JobPrinterUri ) } );
133-
if ( src.JobSheets != null )
134-
dic.Add( JobAttribute.JobSheets, new IppAttribute[] { new IppAttribute( Tag.Keyword, JobAttribute.JobSheets, map.Map<string>( src.JobSheets ) ) } );
135126
if ( src.JobState != null )
136127
dic.Add( JobAttribute.JobState, new IppAttribute[] { new IppAttribute( Tag.Enum, JobAttribute.JobState, (int)src.JobState.Value ) } );
137128
if ( src.JobStateMessage != null )
138129
dic.Add( JobAttribute.JobStateMessage, new IppAttribute[] { new IppAttribute( Tag.TextWithoutLanguage, JobAttribute.JobStateMessage, src.JobStateMessage ) } );
139130
if (src.JobStateReasons?.Any() ?? false)
140131
dic.Add( JobAttribute.JobStateReasons, src.JobStateReasons.Select( x => new IppAttribute( Tag.Keyword, JobAttribute.JobStateReasons, map.Map<string>( x ) ) ).ToArray() );
141-
if ( src.Media != null )
142-
dic.Add( JobAttribute.Media, new IppAttribute[] { new IppAttribute( Tag.Keyword, JobAttribute.Media, src.Media ) } );
143-
if ( src.MultipleDocumentHandling != null )
144-
dic.Add( JobAttribute.MultipleDocumentHandling, new IppAttribute[] { new IppAttribute( Tag.Keyword, JobAttribute.MultipleDocumentHandling, map.Map<string>( src.MultipleDocumentHandling ) ) } );
145-
if ( src.NumberUp != null )
146-
dic.Add( JobAttribute.NumberUp, new IppAttribute[] { new IppAttribute( Tag.Integer, JobAttribute.NumberUp, src.NumberUp.Value ) } );
147-
if ( src.OrientationRequested != null )
148-
dic.Add( JobAttribute.OrientationRequested, new IppAttribute[] { new IppAttribute( Tag.Enum, JobAttribute.OrientationRequested, (int)src.OrientationRequested.Value ) } );
149-
if ( src.PrinterResolution != null )
150-
dic.Add( JobAttribute.PrinterResolution, new IppAttribute[] { new IppAttribute( Tag.Resolution, JobAttribute.PrinterResolution, src.PrinterResolution.Value ) } );
151-
if ( src.PrintQuality != null )
152-
dic.Add( JobAttribute.PrintQuality, new IppAttribute[] { new IppAttribute( Tag.Enum, JobAttribute.PrintQuality, (int)src.PrintQuality.Value ) } );
153-
if ( src.Sides != null )
154-
dic.Add( JobAttribute.Sides, new IppAttribute[] { new IppAttribute( Tag.Keyword, JobAttribute.Sides, map.Map<string>( src.Sides ) ) } );
155132
if (src.TimeAtCompleted != null)
156133
{
157134
if (src.TimeAtCompleted.Value >= 0)
@@ -173,6 +150,32 @@ public void CreateMaps(IMapperConstructor mapper)
173150
else
174151
dic.Add(JobAttribute.TimeAtProcessing, new IppAttribute[] { new IppAttribute(Tag.NoValue, JobAttribute.TimeAtProcessing, NoValue.Instance) });
175152
}
153+
if (src.JobName != null)
154+
dic.Add(JobAttribute.JobName, new IppAttribute[] { new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobName, src.JobName) });
155+
if (src.JobKOctetsProcessed != null)
156+
dic.Add(JobAttribute.JobKOctetsProcessed, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.JobKOctetsProcessed, src.JobKOctetsProcessed.Value) });
157+
if (src.JobImpressions != null)
158+
dic.Add(JobAttribute.JobImpressions, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.JobImpressions, src.JobImpressions.Value) });
159+
if (src.JobMediaSheets != null)
160+
dic.Add(JobAttribute.JobMediaSheets, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.JobMediaSheets, src.JobMediaSheets.Value) });
161+
if (src.JobMoreInfo != null)
162+
dic.Add(JobAttribute.JobMoreInfo, new IppAttribute[] { new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobMoreInfo, src.JobMoreInfo) });
163+
if (src.NumberOfDocuments != null)
164+
dic.Add(JobAttribute.NumberOfDocuments, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.NumberOfDocuments, src.NumberOfDocuments.Value) });
165+
if (src.NumberOfInterveningJobs != null)
166+
dic.Add(JobAttribute.NumberOfInterveningJobs, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.NumberOfInterveningJobs, src.NumberOfInterveningJobs.Value) });
167+
if (src.OutputDeviceAssigned != null)
168+
dic.Add(JobAttribute.OutputDeviceAssigned, new IppAttribute[] { new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.OutputDeviceAssigned, src.OutputDeviceAssigned) });
169+
if (src.JobKOctets != null)
170+
dic.Add(JobAttribute.JobKOctets, new IppAttribute[] { new IppAttribute(Tag.Integer, JobAttribute.JobKOctets, src.JobKOctets.Value) });
171+
if (src.JobDetailedStatusMessages != null)
172+
dic.Add(JobAttribute.JobDetailedStatusMessages, src.JobDetailedStatusMessages.Select(x => new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobDetailedStatusMessages, x)).ToArray());
173+
if (src.JobDocumentAccessErrors != null)
174+
dic.Add(JobAttribute.JobDocumentAccessErrors, src.JobDocumentAccessErrors.Select(x => new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobDocumentAccessErrors, x)).ToArray());
175+
if (src.JobDocumentAccessErrors != null)
176+
dic.Add(JobAttribute.JobDocumentAccessErrors, src.JobDocumentAccessErrors.Select(x => new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobDocumentAccessErrors, x)).ToArray());
177+
if (src.JobMessageFromOperator != null)
178+
dic.Add(JobAttribute.JobMessageFromOperator, new IppAttribute[] { new IppAttribute(Tag.NameWithoutLanguage, JobAttribute.JobMessageFromOperator, src.JobMessageFromOperator) });
176179
return dic;
177180
} );
178181
}

SharpIpp/Protocol/Models/JobAttribute.cs

+9-3
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ public static class JobAttribute
1717
public const string JobId = "job-id";
1818
public const string JobImpressions = "job-impressions";
1919
public const string JobImpressionsCompleted = "job-impressions-completed";
20+
public const string JobKOctets = "job-k-octets";
2021
public const string JobKOctetsProcessed = "job-k-octets-processed";
2122
public const string JobMediaSheets = "job-media-sheets";
2223
public const string JobMediaSheetsCompleted = "job-media-sheets-completed";
2324
public const string JobName = "job-name";
2425
public const string JobOriginatingUserName = "job-originating-user-name";
25-
public const string JobOriginatingUserNameLanguage = "job-originating-user-name-language";
2626
public const string JobPrinterUpTime = "job-printer-up-time";
2727
public const string JobPrinterUri = "job-printer-uri";
2828
public const string JobSheets = "job-sheets";
@@ -39,7 +39,7 @@ public static class JobAttribute
3939
public const string TimeAtCompleted = "time-at-completed";
4040
public const string TimeAtCreation = "time-at-creation";
4141
public const string TimeAtProcessing = "time-at-processing";
42-
public const string NumberOfInterveningJobs = "time-at-processing";
42+
public const string NumberOfInterveningJobs = "number-of-intervening-jobs";
4343
public const string JobPriority = "job-priority";
4444
public const string JobHoldUntil = "job-hold-until";
4545
public const string PageRanges = "page-ranges";
@@ -64,6 +64,13 @@ public static class JobAttribute
6464
public const string Message = "message";
6565
public const string StatusMessage = "status-message";
6666
public const string DetailedStatusMessage = "detailed-status-message";
67+
public const string JobDetailedStatusMessages = "job-detailed-status-messages";
68+
public const string JobDocumentAccessErrors = "job-document-access-errors";
69+
public const string JobMessageFromOperator = "job-message-from-operator";
70+
public const string JobMoreInfo = "job-more-info";
71+
public const string NumberOfDocuments = "number-of-documents";
72+
public const string OutputDeviceAssigned = "output-device-assigned";
73+
6774

6875
public static IEnumerable<string> GetAttributes( IppVersion version )
6976
{
@@ -85,7 +92,6 @@ public static IEnumerable<string> GetAttributes( IppVersion version )
8592
yield return JobMediaSheetsCompleted;
8693
yield return JobName;
8794
yield return JobOriginatingUserName;
88-
yield return JobOriginatingUserNameLanguage;
8995
yield return JobPrinterUpTime;
9096
yield return JobPrinterUri;
9197
yield return JobSheets;

0 commit comments

Comments
 (0)