@@ -747,9 +747,7 @@ private boolean sdlArtworkNeedsUpload(SdlArtwork artwork){
747747 * @return true if primaryGraphic should be updated, false if not
748748 */
749749 private boolean shouldUpdatePrimaryImage () {
750- boolean templateSupportsPrimaryArtwork = (defaultMainWindowCapability != null && defaultMainWindowCapability .getImageFields () != null )
751- ? ManagerUtility .WindowCapabilityUtility .hasImageFieldOfName (defaultMainWindowCapability , ImageFieldName .graphic )
752- : true ;
750+ boolean templateSupportsPrimaryArtwork = templateSupportsImageField (ImageFieldName .graphic );
753751
754752 String currentScreenDataPrimaryGraphicName = (currentScreenData != null && currentScreenData .getGraphic () != null ) ? currentScreenData .getGraphic ().getValue () : null ;
755753 String primaryGraphicName = primaryGraphic != null ? primaryGraphic .getName () : null ;
@@ -763,9 +761,7 @@ private boolean shouldUpdatePrimaryImage() {
763761 * @return true if secondaryGraphic should be updated, false if not
764762 */
765763 private boolean shouldUpdateSecondaryImage () {
766- boolean templateSupportsSecondaryArtwork = (defaultMainWindowCapability != null && defaultMainWindowCapability .getImageFields () != null )
767- ? (ManagerUtility .WindowCapabilityUtility .hasImageFieldOfName (defaultMainWindowCapability , ImageFieldName .graphic ) || ManagerUtility .WindowCapabilityUtility .hasImageFieldOfName (defaultMainWindowCapability , ImageFieldName .secondaryGraphic ))
768- : true ;
764+ boolean templateSupportsSecondaryArtwork = (templateSupportsImageField (ImageFieldName .graphic ) || templateSupportsImageField (ImageFieldName .secondaryGraphic ));
769765
770766 String currentScreenDataSecondaryGraphicName = (currentScreenData != null && currentScreenData .getSecondaryGraphic () != null ) ? currentScreenData .getSecondaryGraphic ().getValue () : null ;
771767 String secondaryGraphicName = secondaryGraphic != null ? secondaryGraphic .getName () : null ;
@@ -774,23 +770,39 @@ private boolean shouldUpdateSecondaryImage() {
774770 && secondaryGraphic != null ;
775771 }
776772
773+ /**
774+ * Check to see if template supports the specified image field
775+ * @return true if image field is supported, false if not
776+ */
777+ private boolean templateSupportsImageField (ImageFieldName name ) {
778+ return (defaultMainWindowCapability != null && defaultMainWindowCapability .getImageFields () != null )
779+ ? ManagerUtility .WindowCapabilityUtility .hasImageFieldOfName (defaultMainWindowCapability , name )
780+ : true ;
781+ }
782+
777783 /**
778784 * Check to see if mediaTrackTextField should be updated
779785 * @return true if mediaTrackTextField should be updated, false if not
780786 */
781- private boolean shouldUpdateMediaTrackField (){
782- return (defaultMainWindowCapability != null && defaultMainWindowCapability .getTextFields () != null )
783- ? ManagerUtility .WindowCapabilityUtility .hasTextFieldOfName (defaultMainWindowCapability , TextFieldName .mediaTrack )
784- : true ;
787+ private boolean shouldUpdateMediaTrackField () {
788+ return shouldUpdateField (TextFieldName .mediaTrack );
785789 }
786790
787791 /**
788792 * Check to see if title should be updated
789793 * @return true if title should be updated, false if not
790794 */
791- private boolean shouldUpdateTitleField (){
795+ private boolean shouldUpdateTitleField () {
796+ return shouldUpdateField (TextFieldName .templateTitle );
797+ }
798+
799+ /**
800+ * Check to see if field should be updated
801+ * @return true if field should be updated, false if not
802+ */
803+ private boolean shouldUpdateField (TextFieldName name ) {
792804 return (defaultMainWindowCapability != null && defaultMainWindowCapability .getTextFields () != null )
793- ? ManagerUtility .WindowCapabilityUtility .hasTextFieldOfName (defaultMainWindowCapability , TextFieldName . templateTitle )
805+ ? ManagerUtility .WindowCapabilityUtility .hasTextFieldOfName (defaultMainWindowCapability , name )
794806 : true ;
795807 }
796808
0 commit comments